<template>
  <el-button v-show="field.id === 'input34855'" @click="showdingAffectedOrderInformation">订单查询</el-button>
  <el-button v-show="field.id === 'input85478'" @click="showdingAffectedOrderInformation">订单查询</el-button>
  <el-button v-show="field.id === 'input87308'" @click="showdingAffectedOrderInformationSelect">订单查询详情</el-button>
  <el-button v-show="field.id === 'input72841'" @click="showdingAffectedOrderInformationSelect">订单查询详情</el-button>
  <el-button v-show="field.id === 'input78145'" @click="showdingAffectedOrderInformation2">收集</el-button>
  <el-button v-show="field.id === 'input44971'" @click="showdingAffectedOrderInformation3">影响分析</el-button>
  <el-button v-show="field.id === 'input122319'" @click="showdingAffectedOrderInformation7(1)">关联变更详情</el-button>
  <el-button v-show="field.id === 'input50763'" @click="showdingAffectedOrderInformation9">库存查询</el-button>
  <!-- <el-button v-show="field.id === 'input57854'" @click="showdingAffectedOrderInformation5(1)">制造BOM影响分析</el-button> -->
  <el-button v-show="field.id === 'input28112'" @click="showdingAffectedOrderInformation4">关联变更件替换分析</el-button>
  <el-button v-show="field.id === 'input55134'" @click="showdingAffectedOrderInformation20">关联变更详情</el-button>
  <!-- <el-button v-show="field.id === 'input37200'" @click="showdingAffectedOrderInformation5()">制造BOM影响分析</el-button> -->
  <el-button v-show="field.id === 'input82882'" @click="showOrderInquiry">订单查询</el-button>
  <!-- 修模通知表单 -->
  <el-button v-show="field.id === 'input92240'" @click="showdingAffectedOrderInformation3(100)">影响分析</el-button>
  <!-- 修模通知表单 -->
  <!-- 指定供应商 -->
  <el-button v-show="field.id === 'input49647'" @click="showdialog('insert')">新增指定</el-button>
  <el-button v-show="field.id === 'input16268'" @click="showdialog('update')">编辑</el-button>
  <el-button v-show="field.id === 'input111314'" @click="showdialogdelete">删除</el-button>
  <el-button v-show="field.id === 'input96502'" @click="showdialogEffect">生效</el-button>
  <el-button v-show="field.id === 'input102657'" @click="showdialogVoid">作废</el-button>
  <!-- 指定供应商 -->

  <!-- 客户ECR -->
  <el-button v-show="field.id === 'input42805'" @click="showdingAffectedOrderInformation3">影响分析</el-button>
  <el-button v-show="field.id === 'input37708'" @click="showdingAffectedOrderInformation7(2)">关联变更详情</el-button>
  <!-- <el-button v-show="field.id === 'input84004'" @click="showdingAffectedOrderInformation9">库存查询</el-button> -->
  <el-button v-show="field.id === 'input4953'" @click="synchronizeCusotomer">同步涉及客户</el-button>
  <!-- 客户ECR -->
  <!-- 订单更改通知表单 -->
  <el-button v-show="field.id === 'input47785'" @click="showdingAffectedOrderInformation4">关联变更件替换分析</el-button>
  <el-button v-show="field.id === 'input52524'" @click="showdingAffectedOrderInformation20">关联变更详情</el-button>
  <el-button v-show="field.id === 'input35086'" @click="showdingAffectedOrderInformation">订单查询</el-button>
  <el-button v-show="field.id === 'input97363'" @click="showdingAffectedOrderInformationSelect">订单查询详情</el-button>
  <!-- <el-button v-show="field.id === 'input87013'" @click="showdingAffectedOrderInformation3">影响分析</el-button> -->
  <el-button v-show="field.id === 'input83191'" @click="showdingAffectedOrderInformation9">库存查询</el-button>
  <!-- <el-button v-show="field.id === 'input86585'" @click="showdingAffectedOrderInformation5(3)">制造BOM影响分析</el-button> -->
  <!-- 订单更改通知表单 -->

  <!-- 制造BOM改通知单 -->
  <el-button v-show="field.id === 'input85657'" @click="showdingAffectedOrderInformation4">关联变更件替换分析</el-button>
  <el-button v-show="field.id === 'input15705'" @click="showdingAffectedOrderInformation20">关联变更详情</el-button>
  <el-button v-show="field.id === 'input65630'" @click="showdingAffectedOrderInformation">订单查询</el-button>
  <el-button v-show="field.id === 'input35029'" @click="showdingAffectedOrderInformationSelect">订单查询详情</el-button>
  <el-button v-show="field.id === 'input105385'" @click="showdingAffectedOrderInformation9">库存查询</el-button>
  <!-- <el-button v-show="field.id === ''" @click="showdingAffectedOrderInformation5(3)">制造BOM影响分析</el-button> -->
  <!-- 制造BOM改通知单 -->
  <!-- 更改请求订单查询 -->
  <el-button v-show="field.id === 'input118612'" @click="showdingAffectedOrderInformation1">订单查询</el-button>
  <!-- 更改请求订单查询 -->
  <!-- 物料选点 -->
  <!-- 物料选点 -->
  <!-- 零星采购申请表、试制样件采购计划、物料选点表单、选择对象按钮 -->
  <el-button v-show="field.id === 'input26802'" @click="openDialog('选择项目令号')">选择项目令号</el-button>
  <el-button v-show="field.id === 'input25352'" @click="openDialog1('零星采购申请表')">选择对象</el-button>
  <el-button v-show="field.id === 'input91027'" @click="openDialog1('试制样件采购计划')">选择对象</el-button>
  <el-button v-show="field.id === 'input117898'" @click="openDialog1('物料选点表单')">选择对象</el-button>
  <!-- 零星采购申请表、试制样件采购计划、物料选点表单、选择对象按钮 -->
  <form-item-wrapper :designer="designer" :field="field" :rules="rules" :design-state="designState"
    :parent-widget="parentWidget" :parent-list="parentList" :index-of-parent-list="indexOfParentList"
    :sub-form-row-index="subFormRowIndex" :sub-form-col-index="subFormColIndex" :sub-form-row-id="subFormRowId" v-show="!['input96502', 'input111314', 'input16268', 'input34855', 'input78145', 'input44971',
      'input122319', 'input57854', 'input28112', 'input55134', 'input37200', 'input50763', 'input49647',
      'input42805', 'input37708', 'input84004', 'input4953', 'input47785', 'input52524', 'input87013',
      'input35086', 'input97363', 'input83191', 'input85657', 'input15705', 'input65630', 'input35029',
      'input92240', 'input102657', 'input87308', 'input86585', 'input105385', 'input118612', 'input25352',
      'input26802', 'input91027', 'input117898', 'input85478', 'input72841'
    ].includes(field.id)">
    <!-- v-show="field.id !== 'input34855' && field.id !== 'input66044'"> -->
    <template v-if="!field.options.hiddenField">
      <span v-if="isReadMode" class="readonly-mode-field" style="word-break: break-all">{{ displayText }}</span>
      <el-input v-else ref="fieldEditor" v-model.trim="fieldModel" :disabled="field.options.disabled"
        :readonly="field.options.readonly" :size="field.options.size" :title="fieldModel || ''" class="hide-spin-button"
        :type="inputType"
        :style="{ 'font-size': `${field.options.fontSize}px`, 'font-family': `${field.options.fontFamily}` }"
        :show-password="field.options.showPassword" :placeholder="field.options.placeholder"
        :clearable="field.options.clearable" :minlength="field.options.minLength" :maxlength="field.options.maxLength"
        :show-word-limit="field.options.showWordLimit" @focus="handleFocusCustomEvent" @blur="handleBlurCustomEvent"
        @input="handleInputCustomEvent" @change="handleChangeEvent">
        <template #prefix>
          <component style="width: 15px; height: 15px" :is="field.options.prefixIcon" />
        </template>
        <template #suffix v-if="field.options.suffixIcon">
          <component style="width: 15px; height: 15px" :is="field.options.suffixIcon" />
        </template>
        <template #append v-if="field.options.appendButton">
          <el-button :disabled="field.options.disabled || field.options.appendButtonDisabled"
            @click="emitAppendButtonClick">
            <el-icon>
              <component :is="field.options.buttonIcon" />
            </el-icon>
          </el-button>
        </template>
      </el-input>
    </template>
  </form-item-wrapper>
  <!-- 零星采购申请表、试制样件采购计划、物料选点表单、选择对象页面 -->
  <el-dialog :title="selectObject.title" v-model="selectObject.dialogVisible" width="80%" class="custom-dialog"
    :before-close="handleClose1">
    <!-- 搜索区域 -->
    <div class="search-container">
      <el-input placeholder="请输入搜索内容" v-model="selectObject.searchText" style="width: 300px; border: 1px solid #000;"
        clearable @input="filterData">
        <i slot="prefix" class="el-input__icon el-icon-search"></i>
      </el-input>
      <el-button type="primary" icon="el-icon-search" style="margin-left: 8px;">搜索</el-button>
    </div>
    <!-- 表格区域 -->
    <div class="table-container">
      <el-table ref="objectTable" :data="pagedData" style="width: 100%" border empty-text="无数据" row-key="AUFNR"
        @selection-change="handleSelectionChange200">
        <!-- 选择框列 -->
        <el-table-column v-if="selectObject.selectType === '选择对象'" type="selection" :reserve-selection="true"
          width="55" />
        <el-table-column v-else type="selection" width="55" />
        <el-table-column prop="AUFNR" label="编号" width="100"></el-table-column>
        <el-table-column prop="KTEXT" label="名称" width="150"></el-table-column>
        <el-table-column prop="AUART" label="订单类型" min-width="200"></el-table-column>
        <el-table-column prop="BUKRS" label="所属公司代码" min-width="200"></el-table-column>
        <el-table-column prop="AUFEX" label="所属项目" min-width="200"></el-table-column>
      </el-table>
    </div>

    <!-- 分页区域 -->
    <div class="pagination-container">
      <el-pagination @size-change="handleSizeChange1" @current-change="handleCurrentChange"
        :current-page="selectObject.currentPage" :page-sizes="[10, 20, 50, 100]" :page-size="selectObject.pageSize"
        layout="total, sizes, prev, pager, next, jumper" :total="selectObject.total">
      </el-pagination>
    </div>

    <!-- 底部按钮 -->
    <div slot="footer" class="dialog-footer">
      <el-button @click="selectObject.dialogVisible = false">取消</el-button>
      <el-button @click="refreshData">刷新</el-button>
      <el-button type="primary" @click="handleConfirm">确定</el-button>
    </div>
  </el-dialog>
  <el-dialog title="选择对象" v-model="dialogVisible123" width="80%" class="custom-dialog" :before-close="closeTree">
    <div class="search-container">
      <el-input placeholder="请输入搜索内容" v-model="selectTree.searchText" style="width: 300px; border: 1px solid #000;"
        clearable @input="filterData">
        <i slot="prefix" class="el-input__icon el-icon-search"></i>
      </el-input>
      <el-button type="primary" icon="el-icon-search" style="margin-left: 8px;" @click="TreehandleSearch">搜索</el-button>
    </div>
    <!-- 表格区域 -->
    <div class="table-container">
      <el-table :data="tableData" style="width: 100%; margin-bottom: 20px;" row-key="objectNumber" border
        default-expand-all :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
        @selection-change="handleSelectionChange250">
        <!-- 多选列 -->
        <el-table-column type="selection" width="55"></el-table-column>
        <!-- 其他列保持不变 -->
        <el-table-column prop="objectNumber" label="编码" width="180"></el-table-column>
        <el-table-column prop="name" label="物料名称" width="180"></el-table-column>
        <el-table-column prop="ibaAttributeMap.SegmNum" label="段号" width="80"></el-table-column>
        <el-table-column prop="ibaAttributeMap.ManufacturingAttr" label="制造属性" width="80"></el-table-column>
        <el-table-column prop="partIbaAttributeMap.Description" label="图样描述" width="180"></el-table-column>
        <el-table-column prop="amount" label="数量" width="80"></el-table-column>
        <el-table-column prop="lifecycleState" label="状态" width="80"></el-table-column>
        <el-table-column prop="measurement" label="计量单位" width="80"></el-table-column>
        <el-table-column prop="createName" label="创建者" width="80"></el-table-column>
        <el-table-column prop="createTime" label="创建时间" width="210"></el-table-column>
      </el-table>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="closeTree()">取消</el-button>
      <el-button type="primary" @click="TreehandleConfirm">确定</el-button>
    </div>
  </el-dialog>
  <!-- 零星采购申请表、试制样件采购计划、物料选点表单、选择对象页面 -->
  <!-- 状态需求表订单查询 -->
  <el-dialog v-model="dialog.affectedOrderInformationXQB" title="订单查询" width="80%">
    <el-collapse v-model="activeNames" accordion>
      <el-collapse-item title="订单查询" name="1">
        <el-row justify="center" style="margin: 20px 0">
          <el-col :span="6">
            <el-form-item label="成品码：">
              <el-input v-model="mBomCode" placeholder="请输入" style="width: 100%;" clearable />
            </el-form-item>
          </el-col>
          <el-col :span="2" style="margin-left: 10px">
            <el-button type="primary" style="background-color: rgb(48, 192, 180);"
              @click="obtainTheFinishedProductCode">
              获取
            </el-button>
          </el-col>
        </el-row>
        <el-form label-width="110px" class="double-form">
        </el-form>
        <el-divider style="margin: 10px 0;"></el-divider>
        <!-- 按钮 -->
        <div style="margin-bottom: 12px; display: flex; gap: 8px;">
          <el-button type="primary" size="small"
            style="background-color: rgb(48, 192, 180); border-color: rgb(48, 192, 180);"
            @click="handleExport('table', '订单查询')">
            导出
          </el-button>
        </div>
        <!-- 表格 -->
        <el-table :data="pagedData" border style="width: 100%" @selection-change="handleSelectionChange"
          :loading="tableLoading" ref="table">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column type="index" label="序号" />
          <el-table-column prop="orderNumber" label="订单号" />
          <el-table-column prop="itemSequence" label="项次" />
          <el-table-column prop="originalPlanDate" label="原计划日期" />
        </el-table>
        <el-pagination background layout="prev, pager, next, jumper, sizes, total" :total="totalRecords"
          :page-size="pageSize" :current-page="currentPage" :page-sizes="[10, 20, 50, 100, 1000]"
          @current-change="handlePageChange" @size-change="handleSizeChange" />

        <div style="margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px;">
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="OrderInquirySubform">
            确定
          </el-button>
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="this.dialog.affectedOrderInformationXQB = false">
            取消
          </el-button>
        </div>
      </el-collapse-item>
    </el-collapse>
  </el-dialog>
  <!-- 订单查询 -->
  <el-dialog v-model="dialog.affectedOrderInformation" title="订单查询" width="80%">
    <el-collapse v-model="activeNames" accordion>
      <el-collapse-item title="订单查询" name="1">
        <el-row justify="center" style="margin: 20px 0">
          <el-col :span="6">
            <el-form-item label="图样代号：" v-if="formType === '设计变更表单'">
              <el-select v-model="PatternCode" placeholder="请选择" style="width: 100%;" filterable remote
                :remote-method="Changeinformationinputdata93" collapse-tags collapse-tags-tooltip clearable>
                <el-option v-for="item in this.options2" :key="item.value" :label="item.value" :value="item.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6" v-if="formType !== '客户ECR表单'">
            <el-form-item label="物料码：">
              <el-select v-model="MaterialCode" placeholder="请选择" style="width: 100%;" filterable remote
                :remote-method="Changeinformationinputdata9" collapse-tags collapse-tags-tooltip clearable>
                <el-option v-for="item in this.options" :key="item.value" :label="item.value" :value="item.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="2" style="margin-left: 10px">
            <el-button type="primary" style="background-color: rgb(48, 192, 180);" @click="getOrderInquiry">
              获取
            </el-button>
          </el-col>
        </el-row>
        <el-form label-width="110px" class="double-form">

        </el-form>

        <el-divider style="margin: 10px 0;"></el-divider>
        <!-- 按钮 -->
        <div style="margin-bottom: 12px; display: flex; gap: 8px;">
          <el-button type="primary" size="small"
            style="background-color: rgb(48, 192, 180); border-color: rgb(48, 192, 180);"
            @click="exportData('pagedData', '订单详情')">
            导出
          </el-button>
        </div>
        <!-- 表格 -->
        <el-table :data="pagedData" border style="width: 100%" @selection-change="handleSelectionChange"
          :loading="tableLoading" ref="table">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column type="index" label="序号" />
          <el-table-column prop="factory" label="工厂" />
          <el-table-column prop="ordernumber" label="订单号" />
          <el-table-column prop="itemno" label="项次" />
          <el-table-column prop="powerproductcode" label="动力成品码" />
          <el-table-column prop="crewproductcode" label="机组成品码" />
          <el-table-column prop="secnumber" label="段号" />
          <el-table-column prop="patterncode" label="图样代号" />
          <el-table-column prop="materialcode" label="物料码" />
          <el-table-column prop="quantity" label="物料用量" />
          <el-table-column prop="model" label="机型" />
          <el-table-column prop="orderquantity" label="订单数量" />
          <el-table-column prop="inventory" label="库存" />
          <el-table-column prop="ordernumber" label="工单号" />
          <el-table-column prop="completedquantity" label="完工数量" />
          <el-table-column prop="customer" label="客户名称" />
          <!-- <el-table-column prop="selection" label="备注" /> -->
        </el-table>
        <el-pagination background layout="prev, pager, next, jumper, sizes, total" :total="totalRecords"
          :page-size="pageSize" :current-page="currentPage" :page-sizes="[10, 20, 50, 100, 1000]"
          @current-change="handlePageChange" @size-change="handleSizeChange" />

        <div style="margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px;">
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="OrderInquiryMain">
            确定
          </el-button>

          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }" @click="Cancel">
            取消
          </el-button>
        </div>
      </el-collapse-item>
    </el-collapse>
  </el-dialog>
  <!-- 更改订单查询 -->
  <el-dialog v-model="dialog.affectedOrderInformation1" title="订单查询" width="80%">
    <el-collapse v-model="activeNames" accordion>
      <el-collapse-item title="订单查询" name="1">
        <el-row justify="center" style="margin: 20px 0">
          <el-col :span="6">
            <el-form-item label="成品码：">
              <el-select v-model="PatternCode" placeholder="请选择" style="width: 100%;" filterable remote
                :remote-method="Changeinformationinputdata93" collapse-tags collapse-tags-tooltip clearable>
                <el-option v-for="item in this.options2" :key="item.value" :label="item.value" :value="item.value" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="2" style="margin-left: 10px">
            <el-button type="primary" style="background-color: rgb(48, 192, 180);" @click="getOrderInquiry1">
              获取
            </el-button>
          </el-col>
        </el-row>
        <el-form label-width="110px" class="double-form">

        </el-form>

        <el-divider style="margin: 10px 0;"></el-divider>
        <!-- 按钮 -->
        <div style="margin-bottom: 12px; display: flex; gap: 8px;">
          <el-button type="primary" size="small"
            style="background-color: rgb(48, 192, 180); border-color: rgb(48, 192, 180);"
            @click="handleExport('pagedData', '订单查询')">
            导出
          </el-button>
        </div>
        <!-- 表格 -->
        <el-table :data="pagedData" border style="width: 100%" @selection-change="handleSelectionChange"
          :loading="tableLoading" ref="table">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column type="index" label="序号" />
          <el-table-column prop="factory" label="工厂" />
          <el-table-column prop="ordernumber" label="订单号" />
          <el-table-column prop="itemno" label="项次" />
          <el-table-column prop="powerproductcode" label="动力成品码" />
          <el-table-column prop="crewproductcode" label="机组成品码" />
          <el-table-column prop="secnumber" label="段号" />
          <el-table-column prop="patterncode" label="图样代号" />
          <el-table-column prop="materialcode" label="物料码" />
          <el-table-column prop="quantity" label="物料用量" />
          <el-table-column prop="model" label="机型" />
          <el-table-column prop="orderquantity" label="订单数量" />
          <el-table-column prop="inventory" label="库存" />
          <el-table-column prop="ordernumber" label="工单号" />
          <el-table-column prop="completedquantity" label="完工数量" />
          <el-table-column prop="customer" label="客户名称" />
          <!-- <el-table-column prop="selection" label="备注" /> -->
        </el-table>
        <el-pagination background layout="prev, pager, next, jumper, sizes, total" :total="totalRecords"
          :page-size="pageSize" :current-page="currentPage" :page-sizes="[10, 20, 50, 100, 1000]"
          @current-change="handlePageChange" @size-change="handleSizeChange" />

        <div style="margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px;">
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="OrderInquiryMain">
            确定
          </el-button>

          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }" @click="Cancel">
            取消
          </el-button>
        </div>
      </el-collapse-item>
    </el-collapse>
  </el-dialog>
  <!-- 订单查询详情 -->
  <el-dialog v-model="dialog.affectedOrderInformationSelect" title="订单查询" width="80%">
    <el-collapse v-model="activeNames" accordion>
      <el-collapse-item title="订单查询详情" name="1">
        <el-divider style="margin: 10px 0;"></el-divider>
        <!-- 按钮 -->
        <div style="margin-bottom: 12px; display: flex; gap: 8px;">
          <el-button type="primary" size="small"
            style="background-color: rgb(48, 192, 180); border-color: rgb(48, 192, 180);"
            @click="exportData('pagedDataSelect', '订单查询')">
            导出
          </el-button>
        </div>
        <!-- 表格 -->
        <el-table ref="pagedDataSelect" :data="pagedDataSelect" border style="width: 100%"
          @selection-change="handleSelectionChange" :loading="tableLoading">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="factory" label="工厂" />
          <el-table-column prop="ordernumber" label="订单号" />
          <el-table-column prop="itemno" label="项次" />
          <el-table-column prop="powerproductcode" label="动力成品码" />
          <el-table-column prop="crewproductcode" label="机组成品码" />
          <el-table-column prop="secnumber" label="段号" />
          <el-table-column prop="patterncode" label="图样代号" />
          <el-table-column prop="materialcode" label="物料码" />
          <el-table-column prop="quantity" label="物料用量" />
          <el-table-column prop="model" label="机型" />
          <el-table-column prop="orderquantity" label="订单数量" />
          <el-table-column prop="inventory" label="库存" />
          <el-table-column prop="ordernumber" label="工单号" />
          <el-table-column prop="completedquantity" label="完工数量" />
          <el-table-column prop="customer" label="客户名称" />
          <!-- <el-table-column prop="selection" label="备注" /> -->
        </el-table>
        <el-pagination background layout="prev, pager, next, jumper, sizes, total" :total="totalRecords"
          :page-size="pageSize" :current-page="currentPage" :page-sizes="[10, 20, 50, 100, 1000]"
          @current-change="handlePageChange" @size-change="handleSizeChange" />
      </el-collapse-item>
    </el-collapse>
  </el-dialog>
  <!-- 关联变更替换分析导入按钮 -->
  <el-dialog v-model="dialog.importAssociationsIsVisible" title="关联变更替换分析导入" width="85%"
    class="floating-dialog import-dialog" :append-to-body="true" :z-index="3000" :close-on-click-modal="false"
    v-draggable :modal="false">
    <!-- 内容区 -->
    <el-input type="textarea" :rows="8"
      placeholder="每行一条，格式：是否锁单(是/否),BOM类型,EBOM号/成品码,是否改制,客户,机型,开发令,V2机型,物料编码,物料描述,总用量,段号,越南生产,状态需求表;"
      v-model="importText" />
    <div style="text-align:right;margin-top:10px">
      <el-button size="small" @click="importText = ''">清空</el-button>
      <el-button type="primary" size="small" @click="handleParse">解析</el-button>
    </div>
    <!-- 底部按钮 -->
    <template #footer>
      <el-button @click="dialog.importAssociationsIsVisible = false">关闭</el-button>
    </template>
  </el-dialog>
  <!-- 关联变更替换件分析 -->
  <el-dialog v-model="dialog.affectedOrderInformation4" title="关联变更替换件分析" width="85%" class="floating-dialog"
    @close="dialog.affectedOrderInformation4 = false">

    <el-collapse v-model="activeCollapse" style="margin: 0px 15px;">
      <el-collapse-item title="变更信息录入" name="basic">
        <el-form label-width="110px" class="double-form">
          <div class="form-row" style="width: 50%;">
            <el-form-item label="变更方式：">
              <el-select v-model="formData.selectType" placeholder="请选择类型" style="width: 100%;"
                @change="querySelectType">
                <el-option label="增加" value="增加" />
                <el-option label="删除" value="删除" />
                <el-option label="修改" value="修改" />
                <!-- <el-option label="移动" value="移动" /> -->
              </el-select>
            </el-form-item>
            <el-form-item label="变更对象类型">
              <el-select v-model="formData.selectObjectType" placeholder="请选择类型"
                style="border-radius: 2px;width: 100%;">
                <el-option label="图样代号" value="PatternCode" v-if="formType === '设计变更表单' || formType === '订单更改通知书'" />
                <el-option label="物料码" value="MaterialCode" />
                <el-option label="标准件" value="Standard" />
              </el-select>
            </el-form-item>
          </div>

          <div class="form-row">
            <el-form-item label="变更前段号：">
              <el-select v-model="Changeinformationinputdata.input1" placeholder="请选择" style="width: 100%;" clearable
                :disabled="operationType === 'add'" filterable>
                <el-option v-for="item in this.options2" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="变更前零件编号 :">
              <el-select v-model="Changeinformationinputdata.input2" placeholder="请选择" style="width: 100%;"
                @change="handleMaterialChange1" filterable remote :remote-method="Changeinformationinputdata99"
                collapse-tags collapse-tags-tooltip clearable :disabled="operationType === 'add'">
                <el-option v-for="item in this.options10" :key="item.value" :label="item.value" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="改前零件名称：">
              <el-input v-model="Changeinformationinputdata.input7" placeholder="请输入" readonly
                :disabled="operationType === 'add'" />
            </el-form-item>
            <el-form-item label="变更前数量：">
              <el-input v-model.number="Changeinformationinputdata.input3" placeholder="请输入数字" @blur="validateNumber(1)"
                :disabled="operationType === 'add'" />
            </el-form-item>
          </div>

          <div class="form-row">
            <el-form-item label="变更后段号：">
              <el-select v-model="Changeinformationinputdata.input4" placeholder="请选择" style="width: 100%;" clearable
                filterable :disabled="operationType === 'delete'">
                <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="变更后零件编号：">
              <el-select v-model="Changeinformationinputdata.input5" placeholder="请选择" style="width: 100%;"
                @change="handleMaterialChange" filterable remote :remote-method="Changeinformationinputdata92"
                collapse-tags collapse-tags-tooltip clearable :disabled="operationType === 'delete'">

                <el-option v-for="item in options1" :key="item.value" :label="item.value" :value="item.value" />
              </el-select>
            </el-form-item>
            <el-form-item label="改后零件名称：">
              <el-input v-model="Changeinformationinputdata.input8" placeholder="请输入" readonly
                :disabled="operationType === 'delete'" />
            </el-form-item>
            <el-form-item label="变更后数量：">
              <el-input v-model.number="Changeinformationinputdata.input6" placeholder="请输入数字" @blur="validateNumber(2)"
                :disabled="operationType === 'delete'" />
            </el-form-item>
          </div>

        </el-form>
      </el-collapse-item>
    </el-collapse>

    <el-collapse v-model="activeCollapse2" style="margin: 0px 15px;">
      <el-collapse-item title="关联变更替换件表格" name="table">

        <div class="table-actions" style="margin-bottom: 10px;">
          <el-button @click="showAffectedBOMfunction()">受影响BOM</el-button>
          <el-button @click="deleteshowAffectedBom">移除</el-button>
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="handleExport('changeObject1', '关联变更替换件表格')">
            导出
          </el-button>
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="lockImmediately('关联变更替换件表格')">
            立即锁定
          </el-button>
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="UnLockImmediately('关联变更替换件表格')">
            立即解锁
          </el-button>
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="importAssociationsIsVisible">
            导入
          </el-button>
        </div>

        <el-table ref="changeObject1" :data="changeObject1" border style="width: 100%"
          @selection-change="handleSelectionChange3">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="isLock" label="是否锁单" />
          <el-table-column prop="bomType" label="BOM类型" />
          <el-table-column prop="code" label="EBOM号/成品码" />
          <el-table-column prop="isRestructure" label="是否改制" />
          <el-table-column prop="CustomerCode" label="客户" />
          <el-table-column prop="productType" label="机型" />
          <el-table-column prop="devCode" label="开发令" />
          <el-table-column prop="V2Model" label="V2机型" />
          <el-table-column prop="MaterialCode" label="物料编码" />
          <el-table-column prop="materialDescription" label="物料描述" />
          <el-table-column prop="count" label="总用量" />
          <el-table-column prop="SegmNum" label="段号" />
          <el-table-column prop="MadeVietnam" label="越南生产" />
          <el-table-column prop="StatusRequireCode" label="状态需求表" />
          <el-table-column prop="error" label="错误" />
        </el-table>
      </el-collapse-item>
    </el-collapse>

    <template #footer>
      <div class="box-footer">
        <el-button @click="dialog.affectedOrderInformation4 = false"
          style="background-color: #31BFB3; color: #ffffff; width: 100px; height: 40px;">取消</el-button>
        <el-button type="primary" @click="onConfirm"
          style="background-color: #31BFB3; color: #ffffff; width: 100px; height: 40px;">确认</el-button>
      </div>
    </template>
  </el-dialog>

  <!-- 关联变更件替换说明关联变更详情 -->
  <el-dialog v-model="dialog.affectedOrderInformation20" title="关联变更详情" width="85%" class="floating-dialog"
    @close="dialog.affectedOrderInformation4 = false">
    <el-collapse v-model="activeCollapse" style="margin: 0px 15px;">
      <el-collapse-item title="变更信息录入" name="basic">
        <el-form label-width="110px" class="double-form">
          <div class="form-row" style="width: 50%;">
            <el-form-item label="变更方式：">
              <el-input v-model="Changeinformationinputdata1.input1" placeholder="请输入" readonly />
            </el-form-item>
            <el-form-item label="变更对象类型">
              <el-input v-model="Changeinformationinputdata1.input1" placeholder="请输入" readonly />
            </el-form-item>
          </div>

          <div class="form-row">
            <el-form-item label="变更前段号：">
              <el-input v-model="Changeinformationinputdata1.input2" placeholder="请输入" readonly />
            </el-form-item>
            <el-form-item label="变更前零件编号 :">
              <el-input v-model="Changeinformationinputdata1.input3" placeholder="请输入" readonly />
            </el-form-item>
            <el-form-item label="改前零件名称：">
              <el-input v-model="Changeinformationinputdata1.input4" placeholder="请输入" readonly />
            </el-form-item>
            <el-form-item label="变更前数量：">
              <el-input v-model="Changeinformationinputdata1.input5" placeholder="请输入" readonly />
            </el-form-item>
          </div>

          <div class="form-row">
            <el-form-item label="变更后段号：">
              <el-input v-model="Changeinformationinputdata1.input6" placeholder="请输入" readonly />
            </el-form-item>
            <el-form-item label="变更后零件编号：">
              <el-input v-model="Changeinformationinputdata1.input7" placeholder="请输入" readonly />
            </el-form-item>
            <el-form-item label="改后零件名称：">
              <el-input v-model="Changeinformationinputdata1.input8" placeholder="请输入" readonly />
            </el-form-item>
            <el-form-item label="变更后数量：">
              <el-input v-model="Changeinformationinputdata1.input9" placeholder="请输入" readonly />
            </el-form-item>
          </div>

        </el-form>
      </el-collapse-item>
    </el-collapse>

    <el-collapse v-model="activeCollapse2" style="margin: 0px 15px;">
      <el-collapse-item title="关联变更替换件表格" name="table">
        <el-table :data="changeObject21" border style="width: 100%">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="bomtype" label="BOM类型" />
          <el-table-column prop="code" label="EBOM号/成品码" />
          <el-table-column prop="isRestructure" label="是否改制" />
          <el-table-column prop="CustomerCode" label="客户" />
          <el-table-column prop="productType" label="机型" />
          <el-table-column prop="devCode" label="开发令" />
          <el-table-column prop="v2Model" label="V2机型" />
          <el-table-column prop="error" label="错误" />
          <el-table-column prop="materialCode" label="物料编码" />
          <el-table-column prop="materialDescription" label="物料描述" />
          <el-table-column prop="count" label="总用量" />
          <el-table-column prop="SegmNum" label="段号" />
          <el-table-column prop="MadeVietnam" label="越南生产" />
          <el-table-column prop="StatusRequireCode" label="状态需求表" />
        </el-table>
      </el-collapse-item>
    </el-collapse>
  </el-dialog>

  <!-- 库存查询 -->
  <el-dialog v-model="dialog.affectedOrderInformation9" title="库存查询" width="80%">
    <el-collapse v-model="activeNames" accordion>
      <el-collapse-item title="库存查询" name="1">
        <el-form label-width="110px" class="double-form">
          <el-row justify="center" style="margin: 20px 0">
            <el-col :span="6">
              <el-form-item label="图样代号：">
                <el-select v-model="this.queryPartInventoryParam.PatternCode" placeholder="请选择" style="width: 100%;"
                  multiple filterable remote :remote-method="PatternCodeSelect9" collapse-tags collapse-tags-tooltip
                  clearable>
                  <el-option v-for="item in this.queryPartInventoryParam1.PatternCode" :key="item.value"
                    :label="item.number" :value="item.number" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="物料码：">
                <el-select v-model="this.queryPartInventoryParam.MaterialCode" placeholder="请选择" style="width: 100%;"
                  filterable remote multiple :remote-method="MaterialCodeSelect9" collapse-tags collapse-tags-tooltip
                  clearable>
                  <el-option v-for="item in this.queryPartInventoryParam1.MaterialCode" :key="item.number"
                    :label="item.number" :value="item.number" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="2" style="margin-left: 10px">
              <el-button type="primary" @click="queryPartInventory"
                style="background-color: rgb(49, 191, 179); color: #ffffff;">查询</el-button>
            </el-col>
          </el-row>
        </el-form>


        <!-- 按钮 -->
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="toggleSelection">全选</el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('tableRef', '库存查询')">导出</el-button>
        <!-- 表格 -->
        <el-table ref="tableRef" :data="PartInventory" border style="width: 100%"
          @selection-change="handleSelectionChange10">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="materialCode" label="物料编码" />
          <el-table-column prop="partName" label="零件名称" />
          <el-table-column prop="onWayInventory" label="在途库存" />
          <el-table-column prop="inPutInventory" label="入库库存" />
          <el-table-column prop="factory" label="货源工厂" />
          <el-table-column prop="supplier" label="供应商" />
        </el-table>
        <div style="margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px;">
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="savePartInventory">
            确定
          </el-button>

          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }" @click="Cancel">
            取消
          </el-button>
        </div>
      </el-collapse-item>
    </el-collapse>
  </el-dialog>


  <!-- 关联变更替换件二级页面 -->
  <el-dialog v-model="showAffectedBOM" title="受影响BOM详情" width="90%" class="affected-bom-dialog"
    @close="showAffectedBOM = false">

    <!-- 输入框区域 -->
    <el-row v-if="formData.selectType === '增加'" :gutter="15" style="padding: 15px; margin: 0;">
      <!-- 第一行 -->
      <el-col :span="7">
        <el-form-item label="物料码" label-width="70px">
          <el-input v-model="filters.MaterialCode" class="grid-input" placeholder="请输入"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="7">
        <el-form-item label="成品码" label-width="70px">
          <el-input v-model="filters.ProductCode" class="grid-input" placeholder="请输入"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="7">
        <el-form-item label="成品码描述" label-width="90px">
          <el-input v-model="filters.description" class="grid-input" placeholder="请输入"></el-input>
        </el-form-item>
      </el-col>
      <!-- 查询按钮 -->
      <el-col :span="3" style="display:flex; align-items:center;">
        <el-button type="primary" style="background-color: rgb(49, 191, 179); color: #ffffff;"
          @click="AffectedBomdetailsinquiry">查询</el-button>
      </el-col>

      <!-- 第二行 -->
      <el-col :span="7" style="margin-top: 10px;">
        <el-form-item label="客户代码" label-width="80px">
          <el-input v-model="filters.CustomerCode" class="grid-input" placeholder="请输入"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="7" style="margin-top: 10px;">
        <el-form-item label="机型" label-width="50px">
          <el-input v-model="filters.productType" class="grid-input" placeholder="请输入"></el-input>
        </el-form-item>
      </el-col>
      <el-col :span="7" style="margin-top: 10px;">
        <el-form-item label="开发令" label-width="60px">
          <el-input v-model="filters.devCode" class="grid-input" placeholder="请输入"></el-input>
        </el-form-item>
      </el-col>
    </el-row>

    <!-- 分界线 -->
    <el-divider style="margin: 10px 0;"></el-divider>

    <!-- 按钮区域 -->
    <el-row style="padding: 0 15px 10px 15px; margin: 0;">
      <el-button type="primary" style="background-color: rgb(49, 191, 179); color: #ffffff; margin-right: 10px;"
        @click="DeleteAffectedBomDetails">移除</el-button>
      <el-button type="primary" style="background-color: rgb(49, 191, 179); color: #ffffff;"
        @click="handleExport('Affectedbomdetailstable', '受影响BOM详情')">导出</el-button>
    </el-row>

    <!-- 表格 -->
    <div style="padding: 0 15px 15px 15px;">
      <el-table ref="Affectedbomdetailstable" :data="Affectedbomdetailstable" border style="width: 100%"
        @selection-change="handleSelectionChange2">
        <el-table-column type="selection" width="50" />
        <el-table-column type="index" label="序号" width="60"></el-table-column>
        <el-table-column prop="CustomerCode" label="客户" />
        <el-table-column prop="devCode" label="开发令" />
        <el-table-column prop="productType" label="机型" />
        <el-table-column prop="V2Model" label="V2机型" />
        <el-table-column prop="code" label="成品码/EBOM号" />
        <el-table-column prop="MaterialCode" label="物料编码" />
        <el-table-column prop="materialDescription" label="物料描述" />
        <el-table-column prop="count" label="总用量" />
        <el-table-column prop="SegmNum" label="段号" />
        <el-table-column prop="MadeVietnam" label="越南生产" />
        <el-table-column prop="StatusRequireCode" label="状态需求表" />
        <el-table-column prop="status" label="成品码状态" />
      </el-table>
    </div>

    <template #footer>
      <span class="dialog-footer">
        <el-button @click="showAffectedBOM = false"
          style="background-color: rgb(49, 191, 179); color: #ffffff; width: 100px; height: 40px;">关闭</el-button>
        <el-button @click="Submit3"
          style="background-color: rgb(49, 191, 179); color: #ffffff; width: 100px; height: 40px;">确认</el-button>
      </span>
    </template>
  </el-dialog>

  <!--  影响分析 -->
  <el-dialog v-model="dialog.affectedOrderInformation3" title="影响分析" width="80%">
    <el-row justify="center" style="margin: 20px 0">
      <el-col :span="6" v-if="formType === '设计变更表单' || formType === '客户ECR表单' || formType === 5">
        <el-form-item label="图样代号：">
          <el-select v-model="PatternCode" placeholder="请选择" style="width: 100%;" filterable remote
            :remote-method="Changeinformationinputdata93" collapse-tags collapse-tags-tooltip clearable>
            <el-option v-for="item in this.options2" :key="item.value" :label="item.value" :value="item.value" />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="6" v-if="formType !== '设计变更表单' && formType !== 5">
        <el-form-item label="物料码：">
          <el-select v-model="MaterialCode" placeholder="请选择" style="width: 100%;" filterable remote
            :remote-method="Changeinformationinputdata9" collapse-tags collapse-tags-tooltip clearable>
            <el-option v-for="item in this.options" :key="item.value" :label="item.value" :value="item.value" />
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="2" style="margin-left: 10px">
        <el-button type="primary" @click="openChangeDetail"
          style="background-color: rgb(49, 191, 179); color: #ffffff;">获取</el-button>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="24">
        <div style="margin-bottom: 10px;">
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="selectAllTables">
            全局全选
          </el-button>
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="clearAllTables">
            全局取消
          </el-button>
          <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
            @click="exportAllTables('影响分析')">
            导出全选
          </el-button>
        </div>
      </el-col>
    </el-row>
    <el-collapse v-model="activeNames">
      <!-- 变更对象 -->
      <el-collapse-item title="收集变更对象" name="1">

        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="selectAllRows('orderTable')">全选</el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('orderTable', '收集变更对象')">导出</el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleWriteToForm">写入表单</el-button>

        <el-table ref="orderTable" :data="changeObject" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange1(val, 'changeObject')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="code" label="编码"></el-table-column>
          <el-table-column prop="name" label="名称"></el-table-column>
          <el-table-column prop="type" label="类型"></el-table-column>
          <el-table-column prop="relationship" label="关系"></el-table-column>
          <el-table-column prop="VERSION" label="版本号"></el-table-column>
          <el-table-column prop="state" label="状态"></el-table-column>
          <el-table-column prop="ManufacturingAttributes" label="制造属性"></el-table-column>
          <el-table-column prop="devCode" label="开发令"></el-table-column>
          <el-table-column prop="UsingtheModel" label="使用机型"></el-table-column>
          <!-- <el-table-column prop="ExclusiveSupplier" label="专属供应商"></el-table-column> -->
          <el-table-column prop="CustomerName" label="客户名称"></el-table-column>
          <el-table-column prop="SourceFactory" label="货源地"></el-table-column>
          <el-table-column prop="supplier" label="供应商"></el-table-column>
          <el-table-column prop="description" label="描述"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 受影响的指定信息 -->
      <el-collapse-item title="受影响的指定信息" name="2">
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="selectAllRows('orderTable1')">
          全选
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('orderTable1', '受影响的指定信息')">
          导出
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="">保存</el-button>
        <el-table ref="orderTable1" :data="appoint" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange1(val, 'appoint')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="customerCode" label="客户编码"></el-table-column>
          <el-table-column prop="CustomerName" label="客户名称"></el-table-column>
          <el-table-column prop="DevelopmentOrder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="materialCode" label="物料编码"></el-table-column>
          <el-table-column prop="MaterialName" label="物料名称"></el-table-column>
          <el-table-column prop="supplierCode" label="供应商编码"></el-table-column>
          <el-table-column prop="SupplierName" label="供应商名称"></el-table-column>
          <el-table-column prop="OrderNo" label="订单号"></el-table-column>
          <el-table-column prop="OrderItemNumber" label="订单项次"></el-table-column>
          <el-table-column prop="SpecifyType" label="指定类型"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- EBOM -->
      <el-collapse-item title="受影响的EBOM" name="3">
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="selectAllRows('orderTable2')">
          全选
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('orderTable2', '受影响的EBOM')">
          导出
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="">保存</el-button>
        <el-table ref="orderTable2" :data="ebom" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange1(val, 'EBOM')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="DevelopmentOrder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="EBOMnumber" label="EBOM号"></el-table-column>
          <el-table-column prop="PatternCode" label="图样代号"></el-table-column>
          <el-table-column prop="TotalUsage" label="总用量"></el-table-column>
          <el-table-column prop="segmentNumber" label="段号"></el-table-column>
          <el-table-column prop="MaterialDescription" label="物料描述"></el-table-column>
          <el-table-column prop="EBOStatus" label="EBOM状态"></el-table-column>
        </el-table>
      </el-collapse-item>

      <el-collapse-item title="受影响的成品BOM" name="4">
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="selectAllRows('orderTable3')">
          全选
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('orderTable3', '受影响的成品BOM')">
          导出
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="">保存</el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="lockImmediately('受影响的成品BOM')">
          立即锁定
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="UnLockImmediately('受影响的成品BOM')">
          立即解锁
        </el-button>
        <el-table ref="orderTable3" :data="finishedBOM" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange1(val, 'FinishedBOM')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="customer" label="客户"></el-table-column>
          <el-table-column prop="DevelopmentOrder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="v2model" label="V2机型"></el-table-column>
          <el-table-column prop="FinishedProductCode" label="成品码"></el-table-column>
          <el-table-column prop="materialCode" label="物料编码"></el-table-column>
          <el-table-column prop="MaterialDescription" label="物料描述"></el-table-column>
          <el-table-column prop="TotalUsage" label="总用量"></el-table-column>
          <el-table-column prop="segmentNumber" label="段号"></el-table-column>
          <el-table-column prop="ProductioninVietnam" label="工厂"></el-table-column>
          <el-table-column prop="StatusRequireTable" label="状态需求表"></el-table-column>
          <el-table-column prop="FinishedProductCodesStatus" label="成品码状态"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 图文档 -->
      <el-collapse-item title="受影响的图文档" name="5">
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="selectAllRows('orderTable4')">
          全选
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('orderTable4', '受影响的图文档')">
          导出
        </el-button>
        <el-table ref="orderTable4" :data="DrawingDocument" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange1(val, 'DrawingDocument')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="documentName" label="文档名称"></el-table-column>
          <el-table-column prop="documentNumber" label="文档编号"></el-table-column>
          <el-table-column prop="fileName" label="文件名称"></el-table-column>
          <el-table-column prop="exclusivesupplier" label="专属供应商"></el-table-column>
          <el-table-column prop="state" label="状态"></el-table-column>
          <el-table-column prop="version" label="版本"></el-table-column>
          <el-table-column prop="type" label="类型"></el-table-column>
          <el-table-column prop="PatternCode" label="图样代号"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 模组 -->
      <el-collapse-item title="受影响的模组关系" name="7">
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="selectAllRows('orderTable6')">
          全选
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('orderTable6', '受影响的模组关系')">
          导出
        </el-button>
        <el-table ref="orderTable6" :data="module" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange1(val, 'module')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="PartCode" label="图样代号"></el-table-column>
          <el-table-column prop="PartName" label="图样名称/物料名称"></el-table-column>
          <el-table-column prop="ModuleNumber" label="模组编号"></el-table-column>
          <el-table-column prop="AssociatedPartCode" label="关联件号（图号/物料）"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 认证 -->
      <el-collapse-item title="受影响的认证信息" name="8">
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="selectAllRows('orderTable7')">
          全选
        </el-button>
        <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
          @click="handleExport('orderTable7', '受影响的认证信息')">
          导出
        </el-button>
        <el-table ref="orderTable7" :data="authentication" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange1(val, 'authentication')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="patternCode" label="图样代号"></el-table-column>
          <el-table-column prop="drawingName" label="图样名称"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="registeredModel" label="备案机型"></el-table-column>
          <el-table-column prop="supplier" label="供应商"></el-table-column>
        </el-table>
      </el-collapse-item>
    </el-collapse>

    <!-- 按钮容器，设置为flex布局并右对齐 -->
    <div style="margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px;">
      <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }" @click="submit">
        确定
      </el-button>

      <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }" @click="Cancel">
        取消
      </el-button>
    </div>
  </el-dialog>


  <!-- 关联变更详情 -->
  <el-dialog v-model="dialog.affectedOrderInformation11" title="关联变更详情" width="80%" @close="handleClose">
    <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
      @click="exportAllTables('关联变更详情')">
      导出所有
    </el-button>
    <!-- 表格上方搜索区域 -->
    <el-collapse v-model="activeNames">
      <!-- 变更对象 -->
      <el-collapse-item title="收集变更对象" name="1">
        <el-table ref="orderTable" :data="changeObject2" border style="width: 100%">
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="code" label="编码"></el-table-column>
          <el-table-column prop="name" label="名称"></el-table-column>
          <el-table-column prop="type" label="类型"></el-table-column>
          <el-table-column prop="relationship" label="关系"></el-table-column>
          <el-table-column prop="version" label="版本号"></el-table-column>
          <el-table-column prop="state" label="状态"></el-table-column>
          <el-table-column prop="manufacturingattributes" label="制造属性"></el-table-column>
          <el-table-column prop="usingthemodel" label="使用机型"></el-table-column>
          <el-table-column prop="exclusivesupplier" label="专属供应商"></el-table-column>
          <el-table-column prop="customername" label="客户名称"></el-table-column>
          <el-table-column prop="sourcefactory" label="货源工厂"></el-table-column>
          <el-table-column prop="supplier" label="供应商"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 受影响的指定信息 -->
      <el-collapse-item title="受影响的指定信息" name="2">
        <el-table ref="orderTable1" :data="appoint2" border style="width: 100%">
          <el-table-column prop="customercode" label="客户编码"></el-table-column>
          <el-table-column prop="customername" label="客户名称"></el-table-column>
          <el-table-column prop="developmentorder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="materialcode" label="物料编码"></el-table-column>
          <el-table-column prop="materialname" label="物料名称"></el-table-column>
          <el-table-column prop="suppliercode" label="供应商编码"></el-table-column>
          <el-table-column prop="suppliername" label="供应商名称"></el-table-column>
          <el-table-column prop="orderno" label="订单号"></el-table-column>
          <el-table-column prop="orderitemnumber" label="订单项次"></el-table-column>
          <el-table-column prop="specifytype" label="指定类型"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- EBOM -->
      <el-collapse-item title="受影响的EBOM" name="3">
        <el-table ref="orderTable2" :data="ebom2" border style="width: 100%">
          <el-table-column prop="developmentorder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="ebomnumber" label="EBOM号"></el-table-column>
          <el-table-column prop="patterncode" label="图样代号"></el-table-column>
          <el-table-column prop="totalusage" label="总用量"></el-table-column>
          <el-table-column prop="segmentnumber" label="段号"></el-table-column>
          <el-table-column prop="materialdescription" label="物料描述"></el-table-column>
          <el-table-column prop="ebostatus" label="EBOM状态"></el-table-column>
        </el-table>
      </el-collapse-item>

      <el-collapse-item title="受影响的成品BOM" name="4">
        <el-table ref="orderTable3" :data="finishedBOM2" border style="width: 100%">
          <el-table-column prop="customer" label="客户"></el-table-column>
          <el-table-column prop="developmentorder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="v2model" label="v2机型"></el-table-column>
          <el-table-column prop="finishedproductcode" label="成品码"></el-table-column>
          <el-table-column prop="materialcode" label="物料编码"></el-table-column>
          <el-table-column prop="materialdescription" label="物料描述"></el-table-column>
          <el-table-column prop="totalusage" label="总用量"></el-table-column>
          <el-table-column prop="segmentnumber" label="段号"></el-table-column>
          <el-table-column prop="productioninvietnam" label="越南生产"></el-table-column>
          <el-table-column prop="statusrequiretable" label="状态需求表"></el-table-column>
          <el-table-column prop="finishedproductcodesstatus" label="成品码状态"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 图文档 -->
      <el-collapse-item title="受影响的图文档" name="5">
        <el-table ref="orderTable4" :data="DrawingDocument2" border style="width: 100%">
          <el-table-column prop="documentname" label="文档名称"></el-table-column>
          <el-table-column prop="documentnumber" label="文档编号"></el-table-column>
          <el-table-column prop="filename" label="文件名称"></el-table-column>
          <el-table-column prop="exclusivesupplier" label="专属供应商"></el-table-column>
          <el-table-column prop="state" label="状态"></el-table-column>
          <el-table-column prop="version" label="版本"></el-table-column>
          <el-table-column prop="type" label="类型"></el-table-column>
          <el-table-column prop="patterncode" label="图样代号"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 模组 -->
      <el-collapse-item title="受影响的模组关系" name="7">
        <el-table ref="orderTable6" :data="module2" border style="width: 100%">
          <el-table-column prop="partcode" label="图样代号"></el-table-column>
          <el-table-column prop="partname" label="图样名称/涂料名称"></el-table-column>
          <el-table-column prop="modulenumber" label="模组编号"></el-table-column>
          <el-table-column prop="associatedpartcode" label="关联件号（图号/物料）"></el-table-column>
        </el-table>
      </el-collapse-item>

      <!-- 认证 -->
      <el-collapse-item title="受影响的认证信息" name="8">
        <el-table ref="orderTable7" :data="authentication2" border style="width: 100%">
          <el-table-column prop="patternCode" label="图样代号"></el-table-column>
          <el-table-column prop="drawingname" label="图样名称"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="registeredmodel" label="备案机型"></el-table-column>
          <el-table-column prop="supplier" label="供应商"></el-table-column>
        </el-table>
      </el-collapse-item>
    </el-collapse>
  </el-dialog>

  <!-- 制造BOM影响分析 -->
  <el-dialog v-model="ChangeImpactMbom.dialogVisible" title="制造BOM影响分析" width="80%" @close="handleClose">
    <el-collapse v-model="activeNames">
      <!-- 受影响的指定信息 -->
      <el-collapse-item title="受影响的指定信息" name="2">
        <el-table ref="orderTable1" :data="ChangeImpactMbom.appoint" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange19(val, 'appoint')">
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="customerCode" label="客户编码"></el-table-column>
          <el-table-column prop="CustomerName" label="客户名称"></el-table-column>
          <el-table-column prop="DevelopmentOrder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="materialCode" label="物料编码"></el-table-column>
          <el-table-column prop="CustomerName" label="物料名称"></el-table-column>
          <el-table-column prop="supplierCode" label="供应商编码"></el-table-column>
          <el-table-column prop="SupplierName" label="供应商名称"></el-table-column>
          <el-table-column prop="OrderNo" label="订单号"></el-table-column>
          <el-table-column prop="OrderItemNumber" label="订单项次"></el-table-column>
          <el-table-column prop="SpecifyType" label="指定类型"></el-table-column>
        </el-table>
      </el-collapse-item>
      <el-collapse-item title="受影响的成品BOM" name="4">
        <el-table ref="orderTable3" :data="ChangeImpactMbom.mbom" border style="width: 100%"
          @selection-change="(val) => handleSelectionChange19(val, 'FinishedBOM')">>
          <el-table-column type="selection" width="50" />
          <el-table-column type="index" label="序号" width="60"></el-table-column>
          <el-table-column prop="customer" label="客户"></el-table-column>
          <el-table-column prop="DevelopmentOrder" label="开发令"></el-table-column>
          <el-table-column prop="model" label="机型"></el-table-column>
          <el-table-column prop="v2model" label="V2机型"></el-table-column>
          <el-table-column prop="FinishedProductCode" label="成品BOM"></el-table-column>
          <el-table-column prop="mbom" label="制造BOM"></el-table-column>
          <el-table-column prop="factory" label="工厂"></el-table-column>
          <el-table-column prop="isAdjust" label="是否调整"></el-table-column>
          <el-table-column prop="materialcode" label="物料编码"></el-table-column>
          <el-table-column prop="MaterialDescription" label="物料描述"></el-table-column>
          <el-table-column prop="TotalUsage" label="总用量"></el-table-column>
          <el-table-column prop="segmentNumber" label="段号"></el-table-column>
          <el-table-column prop="ProductioninVietnam" label="越南生产"></el-table-column>
          <el-table-column prop="StatusRequireTable" label="状态需求表"></el-table-column>
          <el-table-column prop="FinishedProductCodesStatus" label="成品码状态"></el-table-column>
        </el-table>
      </el-collapse-item>
    </el-collapse>
    <div style="margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px;">
      <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
        @click="ChangeImpactMbomSubmit">
        确定
      </el-button>

      <el-button :style="{ backgroundColor: '#30C0B4', color: '#fff', borderColor: '#30C0B4' }"
        @click="ChangeImpactMbomcancel">
        取消
      </el-button>
    </div>
  </el-dialog>

  <!-- 指定管理弹出 -->
  <el-dialog :title="showdialogdata.title" v-model="showdialogdata.dialogVisible" width="1000px" append-to-body
    v-dialog-drag top="15vh">
    <el-collapse v-model="activeCollapse" style="margin: 0 15px;">
      <el-collapse-item title="指定管理信息" name="basic">
        <el-form :model="showdialogdata.form" label-width="100px" :rules="showdialogdata.rules" ref="appointForm">
          <el-row :gutter="20">
            <!-- 第一行 -->
            <el-col :span="24">
              <el-form-item label="需求类型：">
                <el-input v-model="showdialogdata.form.demandtype" readonly></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <!-- 修改开发令下拉值 -->
              <el-form-item label="开发令：" prop="devcode" required="false">
                <el-select v-model="showdialogdata.form.devcode" placeholder="请选择" class="flat-input" filterable
                  @change="handleSelectChange2" clearable>
                  <el-option :label="item.devCode" :value="item.devCode" v-for="item in showdialogdata.option" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <!-- 自动带入 -->
              <el-form-item label="机型：">
                <el-input v-model="showdialogdata.form.ProductType" placeholder="请选择" class="flat-input"
                  readonly></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="客户名称：" prop="devcode" required="false">
                <el-select v-model="showdialogdata.form.customername" placeholder="请选择" class="flat-input" filterable
                  @change="handleSelectChange" clearable>
                  <el-option :label="item.clientName" :value="item.clientName" v-for="item in showdialogdata.option1" />
                </el-select>
              </el-form-item>

            </el-col>
            <el-col :span="8">
              <!-- 自动带入 -->
              <el-form-item label="客户编码：">
                <el-input v-model="showdialogdata.form.customercode" placeholder="请选择" class="flat-input" readonly
                  clearable></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="成品码：">
                <el-select v-model="showdialogdata.form.takeAwayType" placeholder="请选择" class="flat-input" clearable
                  filterable>
                  <el-option :label="item" :value="item" v-for="item in showdialogdata.option3" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="物料编码:" prop="materialcode">
                <el-select v-model="showdialogdata.form.materialcode" placeholder="请选择" class="flat-input" clearable
                  filterable @change="handleSelectChange1">
                  <el-option :label="item.number" :value="item.number" v-for="item in showdialogdata.option2" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="物料名称：">
                <el-input v-model="showdialogdata.form.materialname" placeholder="请输入" class="flat-input" readonly />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="供应商名称：">
                <el-select v-model="showdialogdata.form.suppliercode" placeholder="请选择" class="flat-input"
                  @change="handleSelectChange3" clearable filterable>
                  <el-option :label="item.WERKS" :value="item.WERKS" v-for="item in showdialogdata.option5" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="供应商编码：">
                <!-- <el-select v-model="showdialogdata.form.suppliername" placeholder="请选择" class="flat-input" clearable>
                  <el-option :label="item" :value="item" v-for="item in showdialogdata.option4" />
                </el-select> -->
                <el-input v-model="showdialogdata.form.suppliername" placeholder="请输入" class="flat-input" readonly />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="指定类型：" prop="appointtype">
                <el-select v-model="showdialogdata.form.appointtype" placeholder="请选择" class="flat-input" clearable
                  @change="handleSelectChange6">
                  <el-option label="长期指定" value="长期指定" />
                  <el-option label="临时指定" value="临时指定" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="结束日期：" prop="endtime">
                <el-date-picker v-model="showdialogdata.form.endtime" type="date" placeholder="请选择结束日期"
                  class="flat-input" style="width: 100%;" @change="handleSelectChange5"
                  :picker-options="pickerOptions" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="项次：" prop="orderitemno">
                <el-input v-model="showdialogdata.form.orderitemno" placeholder="请输入" class="flat-input" />
              </el-form-item>
            </el-col>
            <el-col :span="16">
              <el-form-item label="订单号：">
                <el-input v-model="showdialogdata.form.orderno" type="textarea" placeholder="请输入" class="flat-input"
                  :rows="1" :autosize="false" resize="vertical" />
              </el-form-item>
            </el-col>

          </el-row>
        </el-form>
      </el-collapse-item>
    </el-collapse>

    <div slot="footer" class="dialog-footer">
      <el-button @click="showdialogdata.dialogVisible = false">取消</el-button>
      <el-button type="primary" @click="handleSubmit">确定</el-button>
    </div>
  </el-dialog>
  <!-- 指定管理弹出 -->

</template>
<script>

import axios from 'axios';
import formDesigner from '@common/form-designer';
import { request } from '@common/core';
import { config } from 'localforage';
import { isTemplateNode } from '@vue/compiler-dom';
import { ElLoading, ElForm, ElFormItem, ElInput, ElSelect, ElDatePicker } from 'element-plus';
import { array } from 'js-md5';
import { getTransitionRawChildren } from 'vue';
import { message } from 'ant-design-vue';
import { saveAs } from 'file-saver';
import * as XLSX from 'xlsx';
import { isUndefined } from 'min-dash';


const FormItemWrapper = formDesigner.getExportResource('src/form-designer/extension/form-designer/rewrite-field-widget/input-widget-rewrite.vue');
const OriginInput = formDesigner.getExportResource('src/form-designer/components/form-designer/form-widget/field-widget/input-widget.vue');
const { deepClone } = formDesigner.getExportResource('src/form-designer/utils/util.js');
console.log('deepClone', deepClone)
const api = axios.create({
  baseURL: '/rest',
  headers: {
    authorization: sessionStorage.getItem('authorization')
  }
});

export default {
  isGetCustomer: true,
  OrderSelect: null,
  /* 加载功能 */
  dialog: {
    affectedOrderInformation3: false
  },
  // 加载动画控制变量
  loadingInstance: null,
  PatternCode: '',
  MaterialCode: '',
  activeNames: [],
  options2: [],
  changeObject: [],
  appoint: [],
  ebom: [],
  finishedBOM: [],
  DrawingDocument: [],
  module: [],
  authentication: [],
  /* 加载功能 */
  extends: FormItemWrapper.default,
  // extends: OriginInput.default,
  data() {
    return {
      //导入内容
      importText: "",
      tableData: [],
      selectObject: {
        title: "",
        selectType: '',
        dialogVisible: false,
        searchText: "",
        tableData: [],
        filteredData: [], // 过滤后的数据
        currentPage: 1,
        pageSize: 20,
        total: 0, // 数据总数
        selectedItems: [], // 存储选中的项
        selectedIds: new Set()   // 用来存“单选/多选”时真正选中的 AUFNR
      },
      selectTree: {
        type: "",
        treeData: [],
        selectedNodes: [],
      },
      dialogVisible123: false,
      mBomCode: '',
      operationType: 'add',
      formType: "",
      updateSelectDataId: [],//修改管理获取id
      //指定管理获取开发令
      devCode: {},
      changeObject: 0,
      partNumber: "",
      /* 制造BOM影响分析y页面 */
      ChangeImpactMbom: {
        dialogVisible: false,
        appoint: [],
        mbom: [],
        appointSelect: [],
        mbomSelect: []

      },
      /* 指定管理模块 */
      showdialogdata: {
        dialogVisible: false,
        rules: {
          materialcode: [
            { required: true, message: '请选择物料编码', trigger: 'change' }
          ],
          devcode: [
            { required: true, message: '请选择项目令号', trigger: 'change' }
          ],
          appointtype: [
            { required: true, message: '请选择指定类型', trigger: 'change' }
          ],
          orderitemno: [
            { required: false, message: '请输入项次', trigger: 'blur' }
          ],
          endtime: [
            {
              required: false,
              message: '请选择结束日期',
              trigger: 'change'
            },
            {
              validator: this.validateEndTime,
              trigger: 'change'
            }
          ],
          orderno: [
            { required: false, message: '请输入订单号', trigger: 'blur' }
          ]
        },
        form: {
          appointtype: "长期指定"  // 默认值
        },
        option: [
        ],
        option1: [],
        option2: [],
        option3: [
          "AAA001",
          "AAA002",
          "AAA003",
          "AAA004",
          "AAA005",
          "AAA006",
          "AAA007",
          "AAA008",
          "AAA009",
          "AAA010",
          "AAA011",
          "AAA012",
          "AAA013",
          "AAA014",
          "AAA015",
          "AAA016",
          "AAA017",
          "AAA018",
          "AAA019",
          "AAA020",
          "AAA021",
          "AAA022",
          "AAA023",
          "AAA024",
          "AAA025",
          "AAA026",
          "AAA027",
          "AAA028",
          "AAA029",
          "AAA030"
        ],
        option4: [
          "0000151314"
        ],
        option5: [
          { MATNR: "28200-Z2P0412", WERKS: "1043" },
          { MATNR: "28200-Z2P0413", WERKS: "1079" },
          { MATNR: "28200-Z2P0414", WERKS: "1015" },
          { MATNR: "28200-Z2P0415", WERKS: "1051" },
          { MATNR: "28200-Z2P0416", WERKS: "1087" },
          { MATNR: "28200-Z2P0417", WERKS: "1032" },
          { MATNR: "28200-Z2P0418", WERKS: "1068" },
          { MATNR: "28200-Z2P0419", WERKS: "1024" },
          { MATNR: "28200-Z2P0420", WERKS: "1095" },
          { MATNR: "28200-Z2P0421", WERKS: "1003" },
          { MATNR: "28200-Z2P0422", WERKS: "1081" },
          { MATNR: "28200-Z2P0423", WERKS: "1072" },
          { MATNR: "28200-Z2P0424", WERKS: "1010" },
          { MATNR: "28200-Z2P0425", WERKS: "1047" },
          { MATNR: "28200-Z2P0426", WERKS: "1021" },
          { MATNR: "28200-Z2P0427", WERKS: "1091" },
          { MATNR: "28200-Z2P0428", WERKS: "1062" },
          { MATNR: "28200-Z2P0429", WERKS: "1055" },
          { MATNR: "28200-Z2P0430", WERKS: "1074" },
          { MATNR: "28200-Z2P0431", WERKS: "1008" },
          { MATNR: "28200-Z2P0432", WERKS: "1098" },
          { MATNR: "28200-Z2P0433", WERKS: "1018" },
          { MATNR: "28200-Z2P0434", WERKS: "1036" },
          { MATNR: "28200-Z2P0435", WERKS: "1084" },
          { MATNR: "28200-Z2P0436", WERKS: "1049" },
          { MATNR: "28200-Z2P0437", WERKS: "1058" },
          { MATNR: "28200-Z2P0438", WERKS: "1006" },
          { MATNR: "28200-Z2P0439", WERKS: "1029" },
          { MATNR: "28200-Z2P0440", WERKS: "1077" },
          { MATNR: "28200-Z2P0441", WERKS: "1065" },
          { MATNR: "28200-Z2P0442", WERKS: "1013" },
          { MATNR: "28200-Z2P0443", WERKS: "1093" },
          { MATNR: "28200-Z2P0444", WERKS: "1089" },
          { MATNR: "28200-Z2P0445", WERKS: "1034" },
          { MATNR: "28200-Z2P0446", WERKS: "1053" },
          { MATNR: "28200-Z2P0447", WERKS: "1041" },
          { MATNR: "28200-Z2P0448", WERKS: "1001" },
          { MATNR: "28200-Z2P0449", WERKS: "1070" },
          { MATNR: "28200-Z2P0450", WERKS: "1083" },
          { MATNR: "28200-Z2P0451", WERKS: "1090" },
          { MATNR: "28200-Z2P0452", WERKS: "1050" },
          { MATNR: "28200-Z2P0453", WERKS: "1020" },
          { MATNR: "28200-Z2P0454", WERKS: "1069" },
          { MATNR: "28200-Z2P0455", WERKS: "1012" },
          { MATNR: "28200-Z2P0456", WERKS: "1044" },
          { MATNR: "28200-Z2P0457", WERKS: "1086" },
          { MATNR: "28200-Z2P0458", WERKS: "1076" },
          { MATNR: "28200-Z2P0459", WERKS: "1097" },
          { MATNR: "28200-Z2P0460", WERKS: "1026" },
          { MATNR: "28200-Z2P0461", WERKS: "1038" },
          { MATNR: "28200-Z2P0462", WERKS: "1007" }
        ],
      },
      pickerOptions: {
        disabledDate(time) {
          // 禁用今天及之前的所有日期
          return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
        }
      },
      /* 指定管理模块 */
      options10: [],
      changeObject21: [],
      Changeinformationinputdata1: {},
      copy2: false,
      seachChangeObj2: "",
      //关联变更详情值
      changeObject2: [],
      finishedBOM2: [],
      appoint2: [],
      ebom2: [],
      DrawingDocument2: [],
      inventory2: [],
      module2: [],
      authentication2: [],
      PatternCode: "",
      MaterialCode: "",
      changeOrderNumber: "",
      queryPartInventoryParam: { changeNo: this.changNo, PatternCode: [], MaterialCode: [] },//库存查询参数
      queryPartInventoryParam1: { PatternCode: [], MaterialCode: [] },//下拉框中的值
      OurPartInventory: { changeNo: "", partNumbers: [], inventory: [] },//库存查询保存数据
      PartInventory: [],//库存查询数据
      PartInventoryselectedRows: [],//库存查询选中行数据
      Affectedbomdetailsselectdata: {},//受影响BOM详情选中数据
      Relatedchangereplacementpartstableselectdata: {
        changeNo: "",
        partNumber: "",
        affectBOM: "",
      },//关联变更替换件表格选中数据
      Changeinformationinputdata: {},
      Affectedbomdetailstable: [], //受影响BOM详情表格
      seachChangeObj: '',
      ChangeImpactAnalysis: {
        changeNo: "123",
        partNumber: "",
        changeObject: [],
        FinishedBOM: [],
        DrawingDocument: [],
        EBOM: [],
        appoint: [],
        authentication: []
      },//选中的影响分析数据
      selectedValue: '',//关联变更替换件分析变更单更替换件分析中的变更前段号。
      selectedValue1: '',//关联变更替换件分析变更单更替换件分析中的变更后段号。
      selectedValue2: '',
      selectedValue3: '',
      selectedNumver1: '',
      selectedNumver2: '',

      options: [], // 用来存放下拉值
      options1: [], // 用来存放下拉值
      options2: [], // 用来存放下拉值

      selectedRows: [],//获取订单查询窗口选中的数据
      OrderInquiryData: [],   // 总数据
      pagedData: [],          // 当前页数据
      tableLoading: false,
      currentPage: 1,
      pageSize: 10,           // 每页大小
      totalRecords: 0,
      showAffectedBOM: false,//二级页面显示
      activeCollapse: 'basic',
      activeCollapse2: 'table',
      selectedChangeObjectRows: [],//变更对象中选中的值

      dialog: {
        affectedOrderInformation: false,
        affectedOrderInformation1: false,
        affectedOrderInformation3: false,
        affectedOrderInformation4: false,
        affectedOrderInformation9: false,
        affectedOrderInformation2: false,
        affectedOrderInformation11: false,
        affectedOrderInformation20: false,
        affectedOrderInformationXQB: false,
        importAssociationsIsVisible: false,
      },
      activeNames: ['1', '2', '3', '4', '5', '6', '7', '8'],
      changeObject: [],
      finishedBOM: [],
      appoint: [],
      ebom: [],
      DrawingDocument: [],
      inventory: [],
      module: [],
      authentication: [],
      //关联变更替换件分析中的6个按钮对应的值
      formData: {
        selectType: '增加',
        input1: '',
        input2: '',
        input3: '',
        input4: '',
        input5: '',
        input6: ''
      },
      filters: {
        CustomerCode: '',
        devCode: '',
        productType: '',
        ProductCode: '',
        description: '',
        MaterialCode: ''
      },
      //关联变更替换件分析表格值
      changeObject1: [],
      //影响分析保存的partNumber
      partNumber: '',
    };

  },
  mounted() {
    console.log('继承成功');
    if (this.$refs.fieldEditor && this.$refs.fieldEditor.input) {
      this.$refs.fieldEditor.input.style.fontFamily = this.field.options.fontFamily;
      this.$refs.fieldEditor.input.style.textAlign = this.field.options.contentAlign;
    }
    this.setInitDisplayText(deepClone(this.displayText));
    console.log(this, this.$el, this.$options, this.field.id);

    setTimeout(() => {
      this.queryOrderNubmer();
    }, 1000);
    console.log("方法调用")
    // if(this.isGetCustomer){
    this.getCustomer();
    // }
    // this.loadingQueryZdInfo();
  },
  watch: {
    searchText(newValue) {
      this.$nextTick(() => {
        this.filterData(); // 确保过滤后分页更新
      });
    },
  },
  computed: {
    // 获取分页后的数据
    pagedData() {
      const start = (this.selectObject.currentPage - 1) * this.selectObject.pageSize;
      const end = start + this.selectObject.pageSize;
      return this.selectObject.filteredData.slice(start, end);  // 返回当前页的数据
    }
  },
  methods: {
    //解析导入数据
    handleParse() {
      if (!this.importText.trim()) {
        this.$message.warning('粘贴内容不能为空！');
        return;
      }

      // 1. 先按分号拆成多行（记录）
      const lines = this.importText
        .split(';')
        .map(l => l.trim())
        .filter(Boolean);

      let okCount = 0;
      lines.forEach((row, idx) => {
        // 2. 每行按逗号拆成 14 列
        const cols = row.split(',').map(c => c.trim());
        if (cols.length !== 14) {
          this.$message.error(`第 ${idx + 1} 行 列数≠14，已跳过！`);
          return;
        }

        const [
          isLock, bomType, code, isRestructure,
          CustomerCode, productType, devCode, V2Model,
          MaterialCode, materialDescription, count, SegmNum,
          MadeVietnam, StatusRequireCode
        ] = cols;

        this.changeObject1.push({
          isLock, bomType, code, isRestructure,
          CustomerCode, productType, devCode, V2Model,
          MaterialCode, materialDescription, count, SegmNum,
          MadeVietnam, StatusRequireCode
        });
        okCount++;
      });

      this.$message.success(`成功导入 ${okCount} 条数据！`);
      this.dialog.importAssociationsIsVisible = false;
    },
    // 关联变更分析导入方法
    importAssociationsIsVisible() {
      this.dialog.importAssociationsIsVisible = true;
    },
    /* 零星采购申请表、试制样件采购计划、物料选点表单、选择对象 */
    handleSelectionChange250(selection) {
      this.selectTree.selectedNodes = selection;
    },
    flattenByLevelPlus1(tree) {
      const res = [];

      const walk = arr =>
        arr.forEach(n => {
          const level = Number(n.level ?? 0);   // 原始 level
          const prefix = `L${level + 1}`;       // 1→L2, 2→L3 …
          res.push({
            [prefix]: prefix,
            DrawingCode2: n.objectNumber,
            ComponentName: n.name,
            ManufacturingAttribute: (n.ibaAttributeMap?.ManufacturingAttr || []).join(','),
            sectionNumber: (n.ibaAttributeMap?.SegmNum || []).join(','),
            // sectionNumber:n.ibaAttributeMap.SegmNum?n.ibaAttributeMap.SegmNum:"",
            aoid: n.aoid,
            partoid: n.partoid,
            oid: n.oid,
          });
          // 继续递归 children
          if (n.children && n.children.length) walk(n.children);
        });

      walk(tree);
      return res;
    },
    async TreehandleConfirm() {
      const result = this.buildSelectedTree(this.selectTree.selectedNodes);
      console.log('选中的节点（含层级）:', result);
      if (result.length === 0) {
        this.$message.warning("请选择对象");
        return;
      }
      if (this.selectTree.type === "零星采购申请表") {
        var selectData = this.selectTree.selectedNodes;
        var exsitData = this.getWidgetRef("MoldOpeningList").getSubFormValues();
        var exsitDatalength = exsitData.length;
        var saveData = [];
        var subFormData = {};
        if (exsitDatalength > 0) {
          selectData.forEach(row => {
            var boolean1 = true;
            for (var i = 0; i < exsitDatalength; i++) {
              if (exsitData[i].DrawingCode2 === row.objectNumber) {
                boolean1 = false;
                break;
              }
            }
            if (boolean1) {
              subFormData.DrawingCode2 = row.objectNumber;
              subFormData.ItemDescription = row.partIbaAttributeMap?.Description?.[0] ?? '';
              subFormData.QuantityRequired = row.amount;
              saveData.push(subFormData);
            }
            if (saveData.length > 0) {
              this.getWidgetRef("MoldOpeningList").insertSubFormRow(0, false, null, saveData);
            }
          })
        } else {
          selectData.forEach(row => {
            subFormData = {
              DrawingCode2: row.objectNumber,
              ItemDescription: row.partIbaAttributeMap?.Description?.[0] ?? '',
              sectionNumber: row.ibaAttributeMap.SegmNumber ? row.ibaAttributeMap.SegmNumber : "",
            }
            console.log("subFormData", subFormData);
            this.getWidgetRef("MoldOpeningList").insertSubFormRow(0, false, null, [subFormData]);
          })
        }
      } else if (this.selectTree.type === "试制样件采购计划") {
        var exsitData = this.getWidgetRef("PrototypePartsPurchaseSubform").getSubFormValues();
        var exsitDatalength = exsitData.length;
        var saveData = [];
        var subFormData = {};
        if (exsitDatalength > 0) {
          result.forEach(row => {
            var boolean1 = true;
            for (var i = 0; i < exsitDatalength; i++) {
              if (exsitData[i].MaterialCode2 === row.objectNumber) {
                boolean1 = false;
                break;
              }
            }
            if (boolean1) {
              subFormData.MaterialCode2 = row.objectNumber,
                subFormData.MaterialName = row.name,
                // subFormData.Quantity = row.amount
                saveData.push(subFormData);
            }
          })
          if (saveData.length > 0) {
            this.getWidgetRef("PrototypePartsPurchaseSubform").insertSubFormRow(0, false, null, saveData);
          }
        } else {
          result.forEach(row => {
            subFormData = {
              MaterialCode2: row.objectNumber,
              MaterialName: row.name,
              // Quantity: row.amount
            }
            this.getWidgetRef("PrototypePartsPurchaseSubform").insertSubFormRow(0, false, null, [subFormData]);
          })
        }
      } else if (this.selectTree.type === "物料选点表单") {
        console.log("test");
        const arrValue = result;
        var saveData = [];
        var existData = this.getWidgetRef("MoldOpeningList").getSubFormValues();
        var existDataLength = existData.length;
        if (existData.length === 0) {
          const flatList = this.flattenByLevelPlus1(result);
          saveData.push(...flatList);
          const merged = [...saveData];

          // 2. 顺序保留第一次出现的 DrawingCode2
          const seen = new Set();
          const result1 = merged.filter(row => {
            const key = row.DrawingCode2;
            if (seen.has(key)) return false; // 重复，丢弃
            seen.add(key);
            return true;
          });
          // 3. 写回 saveData（如需）
          saveData.length = 0;
          saveData.push(...result1);
          this.getWidgetRef("MoldOpeningList").insertSubFormRow(0, false, null, saveData);
          console.log("saveData", saveData);
        } else {
          const flatList = this.flattenByLevelPlus1(result);
          saveData.push(...flatList);
          console.log("saveData", saveData);
          console.log("existData", existData);
          const result1 = [...existData];
          const seen = new Set(existData.map(r => r.DrawingCode2));

          // 2. saveData 只保留新 DrawingCode2
          result1.push(
            ...saveData.filter(r => {
              const key = r.DrawingCode2;
              if (seen.has(key)) return false;
              seen.add(key);
              return true;
            })
          );

          // 3. 写回 saveData（如需）
          saveData.length = 0;
          saveData.push(...result1);
          console.log("saveData", saveData);
          for (var i = 0; i < existDataLength; i++) {
            this.getWidgetRef('MoldOpeningList').deleteSubFormRow(0);
          }
          this.getWidgetRef("MoldOpeningList").insertSubFormRow(0, false, null, saveData);
        }
        var alreadyData = this.getWidgetRef("MoldOpeningList").getRowIdData();
        setTimeout(async () => {               // <-- 只加 async
          console.log('2 秒到了，执行这里');
          for (var i = 0; i < alreadyData.length; i++) {
            var rowDrawingCode2 = this.getWidgetRef('DrawingCode2@row' + alreadyData[i]).getValue();
            const typeName = 'Blueprint@row' + alreadyData[i];
            var options = await api.get('/v1/fromData/getCADByPartNumber?partNumber=' + rowDrawingCode2);
            const blueprintRef = this.getWidgetRef(typeName);
            console.log('blueprintRef', blueprintRef);
            console.log("options", options.data.data);
            var options1 = []
            if (options.data.data.length !== 0) {
              options.data.data.forEach(item => {
                options1.push({ color: '#FDE5E', label: item, value: item });
              });
              blueprintRef.field.options.optionItems = options1;
            }
          }
        }, 2000);

      }

      // emit 或调用父组件方法
      this.closeTree();
    },
    buildSelectedTree(selectedNodes) {
      const selectedMap = new Map();
      const result = [];

      // 先收集所有选中节点的 objectNumber
      selectedNodes.forEach(node => {
        selectedMap.set(node.objectNumber, node);
      });

      // 判断一个节点是否有被选中的祖先
      const hasSelectedAncestor = (node) => {
        let parent = this.findParent(node, this.tableData);
        while (parent) {
          if (selectedMap.has(parent.objectNumber)) return true;
          parent = this.findParent(parent, this.tableData);
        }
        return false;
      };

      // 过滤出“顶层选中节点”
      const topLevelSelected = selectedNodes.filter(node => !hasSelectedAncestor(node));

      // 构建树结构
      const build = (nodes) => {
        return nodes.map(node => {
          const copy = { ...node };
          if (copy.children) {
            // 只保留被选中的子节点
            const selectedChildren = (copy.children || []).filter(child => selectedMap.has(child.objectNumber));
            copy.children = build(selectedChildren);
          }
          return copy;
        });
      };

      return build(topLevelSelected);
    },
    findParent(targetNode, tree) {
      for (const node of tree) {
        if (node.children) {
          for (const child of node.children) {
            if (child.objectNumber === targetNode.objectNumber) {
              return node;
            }
            const parent = this.findParent(targetNode, node.children);
            if (parent) return parent;
          }
        }
      }
      return null;
    },
    closeTree() {
      this.dialogVisible123 = false
    },
    // 监听选择变化，更新选中的数据
    handleSelectionChange200(rows) {
      if (this.selectObject.selectType === '选择项目令号') {
        // 单选：永远只让最后一条选中
        if (rows.length > 1) {
          const last = rows[rows.length - 1]
          this.$refs.objectTable.clearSelection()
          this.$refs.objectTable.toggleRowSelection(last, true)
          this.selectObject.selectedIds.clear()
          this.selectObject.selectedIds.add(last.AUFNR)
          this.selectObject.selectedItems = [last]
        } else if (rows.length === 1) {
          this.selectObject.selectedIds.clear()
          this.selectObject.selectedIds.add(rows[0].AUFNR)
          this.selectObject.selectedItems = rows
        } else {
          this.selectObject.selectedIds.clear()
          this.selectObject.selectedItems = []
        }
      } else {
        // 多选：直接把 id 池同步即可
        this.selectObject.selectedItems = rows
        this.selectObject.selectedIds = new Set(rows.map(r => r.AUFNR))
      }
    },
    handleSearch() {
      this.selectObject.currentPage = 1
      this.filterData()
    },
    // 刷新数据
    refreshData() {
      this.selectObject.searchText = ''
      this.selectObject.currentPage = 1
      this.filterData()
    },
    // 打开弹框时，初始化数据
    async openDialog(param) {
      this.selectObject.title = this.selectObject.selectType === "选择项目令号" ? "选择项目令号" : "选择对象";
      this.selectObject.selectType = param;

      // 1. 先把数据拿回来
      const { data: res } = await api.post('/v1/integrity/getSapProjectCode', {});

      // 2. 再赋值
      this.selectObject.tableData = res.data || [];
      this.selectObject.filteredData = [...this.selectObject.tableData];
      this.selectObject.total = this.selectObject.filteredData.length;

      // 3. 打开弹窗
      this.selectObject.dialogVisible = true;

      // 4. DOM 渲染完再回显（多选模式）
      this.$nextTick(() => {
        if (param === '选择对象') {
          this.selectObject.tableData.forEach(row => {
            if (this.selectObject.selectedIds.has(row.AUFNR)) {
              this.$refs.objectTable.toggleRowSelection(row, true);
            }
          });
        }
      });
    },
    async TreehandleSearch() {
      this.tableData = [];
      var type;
      if (this.selectTree.type === "零星采购申请表") {
        type = "ProductCode";

      } else {
        type = "EBOM_NUM";
      }
      const { data: res } = await api.get('/v1/form/queryEBom?number=' + this.selectTree.searchText + '&type=' + type);
      // const { data: res } = await api.get('/v1/form/queryEBom?number=' + this.selectTree.searchText + '&type=EBOM_NUM');
      if (res.data.length === 0) {
        if (type === "ProductCode") {
          this.$message.warning('未找到此成品码');
        } else {
          this.$message.warning('未找到此EBOM号');
        }
        return;
      }
      this.tableData = res.data.map(item => {
        // 深拷贝对象
        const newItem = JSON.parse(JSON.stringify(item));
        // 删除空的 children 数组
        if (newItem.children && Array.isArray(newItem.children) && newItem.children.length === 0) {
          delete newItem.children;
        }

        // 递归处理子节点（如果有的话）
        if (newItem.children && newItem.children.length > 0) {
          newItem.children = newItem.children.map(child => {
            if (child.children && Array.isArray(child.children) && child.children.length === 0) {
              delete child.children;
            }
            return {
              ...child,
              hasChildren: false  // 子节点没有子节点了
            };
          });
        }

        return {
          ...newItem,
          hasChildren: newItem.children && newItem.children.length > 0
        };
      });
      console.log("tableData", this.tableData);
    },
    async openDialog1(params) {
      this.tableData = [];
      this.selectTree.selectedNodes = [];
      this.selectTree.type = params;
      this.dialogVisible123 = true;
      console.log("tableData", this.tableData);
    },
    // 处理分页大小变化
    handleSizeChange1(newSize) {
      this.selectObject.pageSize = newSize
      this.selectObject.currentPage = 1         // 切条数时回到第一页
      // 同样不需要再调 filterData()
    },
    // 处理页码变化
    handleCurrentChange(newPage) {
      this.selectObject.currentPage = newPage   // 组件已经改过了，这里保留即可
      // 前端分页直接依赖 pagedData 计算属性，无需再手动过滤
    },
    // 过滤数据
    filterData() {
      const query = this.selectObject.searchText.toLowerCase()
      this.selectObject.filteredData = this.selectObject.tableData.filter(
        item =>
          item.KTEXT.toLowerCase().includes(query) ||
          item.AUFNR.toLowerCase().includes(query)
      )
      this.selectObject.total = this.selectObject.filteredData.length
    },
    // 确认选择的对象
    handleConfirm() {
      // 获取选中的数据
      const selectedItems = this.selectObject.selectedItems;
      console.log("选择的对象:", selectedItems);
      if (this.selectObject.selectType === '选择项目令号') {
        this.getWidgetRef('@SAPProjectNumber').setValue(selectedItems[0].AUFNR, true);
      }
      this.selectObject.dialogVisible = false;
    },
    // 关闭弹框时的操作
    handleClose1(done) {
      // 1. 清空搜索条件（可选）
      this.selectObject.searchText = ''
      this.selectObject.filteredData = [...this.selectObject.tableData]

      // 2. 真正关闭弹窗
      this.selectObject.dialogVisible = false

      // 3. 调用 done() 让 ElDialog 内部完成收尾（必须）
      done()
    },
    /* 零星采购申请表、试制样件采购计划、物料选点表单、选择对象 */
    showOrderInquiry() {
      this.dialog.affectedOrderInformationXQB = true;
    },
    //下单锁定与解锁方法
    async lockProductOrder(params) {
      const returnData = await api.post('/change/v1/lockProductOrder', params);
      if (returnData.data.success && params.type === 'lock') {
        this.$message.success("锁定成功");
      } else if (returnData.data.success && params.type === 'unlock') {
        this.$message.success("解锁成功");
      }
    },
    validateEndTime(rule, value, callback) {
      if (!value) {
        callback(new Error('请选择结束日期'));
        return;
      }

      const selectedDate = new Date(value);
      const today = new Date();
      today.setHours(0, 0, 0, 0); // 设置为今天的开始时间

      if (selectedDate <= today) {
        callback(new Error('结束日期必须大于当前日期'));
      } else {
        callback();
      }
    },
    lockImmediately(type) {
      var selectData;
      var params;
      if (type === '关联变更替换件表格') {
        selectData = this.Relatedchangereplacementpartstableselectdata.affectBOM;
        if (selectData.length === 0) {
          this.$message.error("请选择要锁定的行！");
          return;
        }
        for (var i = 0; i < selectData.length; i++) {
          if (selectData[i].bomType !== '成品码') {
            this.$message.warning("选择数据中存在非成品码类型");
            return;
          }
        }
        console.log("selectData", selectData);
        //调用方法
        params = {
          type: "lock",
          changeNo: this.changNo,
          partNumber: this.Changeinformationinputdata.input2 ? this.Changeinformationinputdata.input2 : this.Changeinformationinputdata.input5,
          prodcutList: [],
        }
        selectData.forEach(row => {
          var prodcutListRow = {
            productCode: row.code,
            productVersion: row.objectversion,
            materialCode: row.MaterialCode,
            // orderNo:row.
          }
          params.prodcutList.push(prodcutListRow);
        })
      } else {
        selectData = this.ChangeImpactAnalysis.FinishedBOM
        if (selectData.length === 0) {
          this.$message.error("请选择要锁定的行！");
          return;
        }
        //调用方法
        params = {
          type: "lock",
          changeNo: this.changNo,
          partNumber: this.PatternCode ? this.PatternCode : this.MaterialCode,
          prodcutList: [],
        }
        selectData.forEach(row => {
          var prodcutListRow = {
            productCode: row.FinishedProductCode,
            productVersion: row.objectversion,
            materialCode: row.materialCode,
          }
          params.prodcutList.push(prodcutListRow);
        })
      }
      this.lockProductOrder(params);
    },
    UnLockImmediately(type) {
      var selectData;
      var params;
      if (type === '关联变更替换件表格') {
        selectData = this.Relatedchangereplacementpartstableselectdata.affectBOM;
        if (selectData.length === 0) {
          this.$message.error("请选择要锁定的行！");
          return;
        }
        for (var i = 0; i < selectData.length; i++) {
          if (selectData[i].bomType !== '成品码') {
            this.$message.warning("选择数据中存在非成品码类型");
            return;
          }
        }
        console.log("selectData", selectData);
        //调用方法
        params = {
          type: "unlock",
          changeNo: this.changNo,
          partNumber: this.Changeinformationinputdata.input2 ? this.Changeinformationinputdata.input2 : this.Changeinformationinputdata.input5,
          prodcutList: [],
        }
        selectData.forEach(row => {
          var prodcutListRow = {
            productCode: row.code,
            productVersion: row.objectversion,
            materialCode: row.MaterialCode,
            // orderNo:row.
          }
          params.prodcutList.push(prodcutListRow);
        })
      } else {
        selectData = this.ChangeImpactAnalysis.FinishedBOM;
        if (selectData.length === 0) {
          this.$message.error("请选择要锁定的行！");
          return;
        }
        console.log("selectData", selectData);
        //调用方法
        params = {
          type: "unlock",
          changeNo: this.changNo,
          partNumber: this.PatternCode ? this.PatternCode : this.MaterialCode,
          prodcutList: [],
        }
        selectData.forEach(row => {
          var prodcutListRow = {
            productCode: row.FinishedProductCode,
            productVersion: row.objectversion,
            materialCode: row.materialCode,
          }
          params.prodcutList.push(prodcutListRow);
        })
      }
      this.lockProductOrder(params);
      //调用方法
    },
    //关联变更分析根据状态置灰
    querySelectType(ctype) {
      console.log("ctype", ctype);
      if (ctype == '增加') {
        this.operationType = 'add';
      } else if (ctype == '删除') {
        this.operationType = 'delete';
      } else {
        this.operationType = 'edit';
      }
      this.Changeinformationinputdata = {};
      console.log("operationType", this.operationType);
    },
    // 关联变更详情全局导出方法
    exportAllTables(bomType) {
      try {
        var tables;
        // 定义所有表格的配置
        if (bomType === '关联变更详情') {
          tables = [
            { ref: 'orderTable', name: '变更对象', data: this.changeObject2 },
            { ref: 'orderTable1', name: '受影响的指定信息', data: this.appoint2 },
            { ref: 'orderTable2', name: '受影响的EBOM', data: this.ebom2 },
            { ref: 'orderTable3', name: '受影响的成品BOM', data: this.finishedBOM2 },
            { ref: 'orderTable4', name: '受影响的图文档', data: this.DrawingDocument2 },
            { ref: 'orderTable6', name: '受影响的模组关系', data: this.module2 },
            { ref: 'orderTable7', name: '受影响的认证信息', data: this.authentication2 },
            { ref: 'orderTable', name: '收集变更对象', data: this.changeObject }
          ];
        } else {
          tables = [
            { ref: 'orderTable', name: '收集变更对象', data: this.changeObject },
            { ref: 'orderTable1', name: '受影响的指定信息', data: this.appoint },
            { ref: 'orderTable2', name: '受影响的EBOM', data: this.ebom },
            { ref: 'orderTable3', name: '受影响的成品BOM', data: this.finishedBOM },
            { ref: 'orderTable4', name: '受影响的图文档', data: this.DrawingDocument },
            { ref: 'orderTable6', name: '受影响的模组关系', data: this.module },
            { ref: 'orderTable7', name: '受影响的认证信息', data: this.authentication }
          ];
        }

        // 创建工作簿
        const wb = XLSX.utils.book_new();

        // 遍历所有表格
        tables.forEach(table => {
          if (table.data && table.data.length > 0) {
            // 创建工作表
            const ws = XLSX.utils.json_to_sheet(table.data);

            // 添加工作表到工作簿
            XLSX.utils.book_append_sheet(wb, ws, table.name);
          } else {
            console.warn(`${table.name}没有数据可导出`);
          }
        });

        // 检查是否有数据
        if (wb.SheetNames.length === 0) {
          this.$message.warning('没有数据可导出');
          return;
        }

        // 导出Excel文件
        if (bomType === '关联变更详情') {
          const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
          saveAs(new Blob([wbout], { type: 'application/octet-stream' }), '关联变更详情.xlsx');
        } else {
          const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
          saveAs(new Blob([wbout], { type: 'application/octet-stream' }), '影响分析数据.xlsx');
        }

        this.$message.success('导出成功');
      } catch (error) {
        console.error('导出失败:', error);
        this.$message.error('导出失败: ' + error.message);
      }
    },
    // 导出表格数据为 Excel
    exportToExcel(tableRef, fileName = '导出数据') {
      console.log("开始导出");
      const table = this.$refs[tableRef];
      if (!table || !table.data || table.data.length === 0) {
        this.$message.warning('没有数据可导出');
        return;
      }

      // 获取表格列配置
      const columns = table.columns.filter(col => col.property && col.label);

      // 构建中文表头映射
      const headerMap = {};
      const headers = [];
      columns.forEach(col => {
        headerMap[col.property] = col.label;
        headers.push(col.label);
      });

      // 构建带中文 key 的数据
      const data = table.data.map(row => {
        const obj = {};
        columns.forEach(col => {
          obj[col.label] = row[col.property];
        });
        return obj;
      });

      // 生成 Excel 数据
      const ws = XLSX.utils.json_to_sheet(data, { header: headers });
      const wb = XLSX.utils.book_new();
      XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');

      // 导出文件
      const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
      saveAs(new Blob([wbout], { type: 'application/octet-stream' }), `${fileName}.xlsx`);
    },
    queryOrderNubmer() {
      let chagneNo = this.getWidgetRef('input86681')?.getValue() ?? "";
      let chagneNo1 = this.getWidgetRef('input49400')?.getValue() ?? "";
      let chagneNo2 = this.getWidgetRef('input34374')?.getValue() ?? "";
      let chagneNo3 = this.getWidgetRef('input56967')?.getValue() ?? "";
      let chagneNo4 = this.getWidgetRef('input49376')?.getValue() ?? "";
      console.log("chagneNo", chagneNo);
      console.log("chagneNo1", chagneNo1);
      console.log("chagneNo2", chagneNo2);
      console.log("chagneNo3", chagneNo3);
      console.log("chagneNo4", chagneNo4);
      if (chagneNo !== "" && chagneNo !== null && chagneNo !== undefined) {
        this.changNo = chagneNo;
        this.formType = '设计变更表单'
      } else if (chagneNo1 !== "" && chagneNo1 !== null && chagneNo1 !== undefined) {
        this.changNo = chagneNo1;
        this.formType = '客户ECR表单'
      } else if (chagneNo2 !== "" && chagneNo2 !== null && chagneNo2 !== undefined) {
        this.changNo = chagneNo2;
        this.formType = '订单更改通知书'
      } else if (chagneNo3 !== "" && chagneNo3 !== null && chagneNo3 !== undefined) {
        this.changNo = chagneNo3;
        this.formType = '制造BOM改通知单'
      } else if (chagneNo4 !== "" && chagneNo4 !== null && chagneNo4 !== undefined) {
        this.changNo = chagneNo4;
        this.formType = 5
      }
      console.log("变更单号", this.changNo);
    },

    showdialogVoid() {
      let dataid = this.getWidgetRef('subform67098').selectedRowData;
      let data = this.getWidgetRef('subform67098').getSubFormValues();
      if (dataid.length === 0) {
        this.$message.warning("请选择作废对象");
        return;
      }
      this.$confirm('确定作废当前指定供应商?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        zIndex: 2011,
      }).then(() => {
        let indexcopy;
        for (var i = 0; i < dataid.length; i++) {
          data.forEach((row, index) => {
            if (row._rowId_ === dataid[i]) {
              indexcopy = index;
              row.input40813 = "作废";
            }
          })
        }
        this.getWidgetRef('subform67098').updateRowWithoutRender(data, indexcopy);
        this.$message.success("作废成功");
      })
    },
    showdialogEffect() {
      let dataid = this.getWidgetRef('subform67098').selectedRowData;
      let data = this.getWidgetRef('subform67098').getSubFormValues();
      if (dataid.length === 0) {
        this.$message.warning("请选择生效对象");
        return;
      }
      this.$confirm('确定作废当前指定供应商?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        zIndex: 2011,
      }).then(() => {
        let indexcopy;
        for (var i = 0; i < dataid.length; i++) {
          data.forEach((row, index) => {
            if (row._rowId_ === dataid[i]) {
              indexcopy = index;
              row.input40813 = "生效";
            }
          })
        }
        this.getWidgetRef('subform67098').updateRowWithoutRender(data, indexcopy);
        this.$message.success("生效成功");
      })
    },
    //查询指定信息列表
    async queryZdInfo(data) {
      const returnParams = await api.post('/zd/queryZdInfo', data);
      return returnParams
    },
    //加载初始数据
    loadingQueryZdInfo() {
      this.queryZdInfo({ pageNum: "1", pageSize: "20" });
    },
    //删除指定供应商
    async showdialogdelete() {
      let dataid = this.getWidgetRef('subform67098').selectedRowData;
      let data = this.getWidgetRef('subform67098').getSubFormValues();
      if (dataid.length === 0) {
        this.$message.warning("请选择删除对象");
        return;
      }
      this.$confirm('确定移除当前指定供应商?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        zIndex: 2011,
      }).then(async () => {
        var returnData;
        var returnSucces = true;
        if (returnSucces) {
          this.$message({
            type: 'success',
            message: '移除成功!'
          });
          dataid.forEach(row1 => {
            data.forEach((row, index) => {
              if (row._rowId_ === row1) {
                this.getWidgetRef('subform67098').deleteSubFormRow(index);
              }
            });
          })
        } else {
          this.$message.error('移除失败');
        }
      }).catch();

    },
    handleSelectChange(selectedValue) {
      console.log("selectedValue", selectedValue);
      const selectedItem = this.showdialogdata.option1.find(
        item => item.clientName === selectedValue
      );
      console.log("选中的完整对象:", selectedItem);
      this.showdialogdata.form.customercode = selectedItem.clientCode;
    },
    handleSelectChange1(selectedValue) {
      console.log("selectedValue", selectedValue);
      const selectedItem = this.showdialogdata.option2.find(
        item => item.number === selectedValue
      );
      console.log("选中的完整对象:", selectedItem);
      this.showdialogdata.form.materialname = selectedItem.name;
    },
    //
    handleSelectChange2(selectedValue) {
      console.log("selectedValue", selectedValue);
      const selectedItem = this.showdialogdata.option.find(
        item => item.devCode === selectedValue
      );
      console.log("选中的完整对象:", selectedItem);
      this.showdialogdata.form.ProductType = selectedItem.ProductType;
    },
    handleSelectChange3(selectedValue) {
      console.log("selectedValue", selectedValue);
      const selectedItem = this.showdialogdata.option5.find(
        item => item.WERKS === selectedValue
      );
      console.log("选中的完整对象:", selectedItem);
      this.showdialogdata.form.suppliername = selectedItem.MATNR;
    },
    handleSelectChange4() {
      if (this.showdialogdata.form.suppliercode || this.showdialogdata.form.orderno || this.showdialogdata.form.endtime) {
        this.showdialogdata.form.appointtype = "临时指定"
      }
    },
    handleSelectChange5() {
      if (this.showdialogdata.form.endtime) {
        const dataTime = new Date();
        // this.showdialogdata.form.endtime.setHours(0, 0, 0, 0);
        dataTime.setHours(0, 0, 0, 0);
        if (this.showdialogdata.form.endtime <= dataTime) {
          this.
            return;
        }
      }
    },
    async handleSelectChange6(selectedValue) {
      if (selectedValue === "临时指定") {
        var rules = this.showdialogdata.rules
        rules =
        {
          materialcode: [
            { required: true, message: '请选择物料编码', trigger: 'change' }
          ],
          devcode: [
            { required: true, message: '请选择项目令号', trigger: 'change' }
          ],
          appointtype: [
            { required: true, message: '请选择指定类型', trigger: 'change' }
          ],
          orderitemno: [
            { required: true, message: '请输入项次', trigger: 'blur' }
          ],
          endtime: [
            { required: true, message: '请选择结束日期', trigger: 'change' }
          ],
          orderno: [
            { required: true, message: '请输入订单号', trigger: 'blur' }
          ]
        }
        this.showdialogdata.rules = rules
      } else {
        var rules = this.showdialogdata.rules
        rules =
        {
          materialcode: [
            { required: true, message: '请选择物料编码', trigger: 'change' }
          ],
          devcode: [
            { required: true, message: '请选择项目令号', trigger: 'change' }
          ],
          appointtype: [
            { required: true, message: '请选择指定类型', trigger: 'change' }
          ],
          orderitemno: [
            { required: false, message: '请输入项次', trigger: 'blur' }
          ],
          endtime: [
            {
              required: false,
              message: '请选择结束日期',
              trigger: 'change'
            },
            {
              validator: this.validateEndTime,
              trigger: 'change'
            }
          ],
          orderno: [
            { required: false, message: '请输入订单号', trigger: 'blur' }
          ]
        }
        this.showdialogdata.rules = rules
      }
    },
    async checkExist(formatted) {
      const returnedData = await api.post("/zd/checkExist", {
        CustomerCode: this.showdialogdata.form.customercode,
        DevCode: this.showdialogdata.form.devcode,
        Category: this.showdialogdata.form.materialcode,
        AppointSupplier: this.showdialogdata.form,
        EndTime: formatted,
        OrderNo: this.showdialogdata.form.orderno,
        OrderItemNo: this.showdialogdata.form.orderitemno,
      });
      return returnedData;
    },
    async handleSubmit() {
      if (this.showdialogdata.form.endtime) {
        const dataTime = new Date();
        // this.showdialogdata.form.endtime.setHours(0, 0, 0, 0);
        dataTime.setHours(0, 0, 0, 0);
        if (this.showdialogdata.form.endtime <= dataTime) {
          this.$message({
            message: "请选择正确的结束日期",
            type: "warning",
            zIndex: 99999
          });
          return;
        }
      }
      this.$refs.appointForm.validate((valid) => {
        if (!valid) {
          this.$message.error('请完善表单必填项');
          return;
        }
        try {
          if (this.showdialogdata.form.demandtype == '新增') {
            const randomId = 'id' + Math.floor(Math.random() * 1000000);
            const formatted = this.showdialogdata.form.endtime
              ? this.showdialogdata.form.endtime.toISOString().split('T')[0]
              : '';
            let query = {
              _rowId_: randomId,
              input17817: this.showdialogdata.form.demandtype,
              input75631: this.showdialogdata.form.customercode,
              input94778: this.showdialogdata.form.customername,
              input80138: this.showdialogdata.form.devcode,
              input11655: this.showdialogdata.form.ProductType,
              input66947: this.showdialogdata.form.materialcode,
              input20325: this.showdialogdata.form.materialname,
              input80487: this.showdialogdata.form.suppliercode,
              input7629: this.showdialogdata.form.suppliername,
              input21986: this.showdialogdata.form.orderno,
              input68758: this.showdialogdata.form.appointtype,
              input111716: formatted,
              input112797: this.showdialogdata.form.orderitemno,
              input94969: this.showdialogdata.form.takeAwayType,
              input40813: "生效"
            };
            var returnedData = this.checkExist(formatted);
            if (!returnedData) {
              this.$message.warning("该条数据以存在");
              return;
            }
            this.getWidgetRef('subform67098').insertSubFormRow(0, false, null, [query]);
          }
          else if (this.showdialogdata.form.demandtype == '修改') {
            let data = this.getWidgetRef('subform67098').getSubFormValues();
            let indexcopy;
            data.forEach((row, index) => {
              if (row._rowId_ === this.updateSelectDataId) {
                indexcopy = index;
                row.input17817 = this.showdialogdata.form.demandtype;
                row.input75631 = this.showdialogdata.form.customercode;
                row.input94778 = this.showdialogdata.form.customername;
                row.input80138 = this.showdialogdata.form.devcode;
                row.input11655 = this.showdialogdata.form.ProductType;
                row.input66947 = this.showdialogdata.form.materialcode;
                row.input20325 = this.showdialogdata.form.materialname;
                row.input80487 = this.showdialogdata.form.suppliercode;
                row.input7629 = this.showdialogdata.form.suppliername;
                row.input21986 = this.showdialogdata.form.orderno;
                row.input68758 = this.showdialogdata.form.appointtype;
                row.input111716 = this.showdialogdata.form.endtime;
                row.input112797 = this.showdialogdata.form.orderitemno;
                row.input94969 = this.showdialogdata.form.takeAwayType;
              }
            });
            // 
            var returnedData = this.checkExist(formatted);
            if (!returnedData) {
              this.$message.warning("该条数据以存在");
              return;
            }
            this.getWidgetRef('subform67098').updateRowWithoutRender(data, indexcopy);
          }

          this.showdialogdata.dialogVisible = false;
          this.$message.success('操作成功');
        } catch (error) {
          console.error('提交失败:', error);
          this.$message.error('操作失败');
        }
      });
      // 所有校验通过，执行提交逻辑

    },
    /* ECR变更 */
    synchronizeCusotomer() {
      //huangxumin
      console.log("测试专用");
      var data2 = this.getWidgetRef('subform47946').getSubFormValues();
      var arryas;
      var arryas3 = [];
      data2.forEach(row => {
        if (row.input69378) {
          arryas = row.input69378.split(",");
          arryas3.push(...arryas);
        }
      });
      var data1 = [...new Map(arryas3.map(item => {
        // 通过 Proxy 访问原始值
        const rawValue = item; // 替换为你需要去重的属性
        return [rawValue, item];
      })).values()];
      var data1Length = data1.length;
      var data2 = this.getWidgetRef('subform44512').getSubFormValues();
      var data2Length = data2.length;
      var saveData = [];
      for (var i = 0; i < data1Length; i++) {
        if (data1[i]) {
          const randomId = 'id' + Math.floor(Math.random() * 1000000);
          const subFormRowData = {
            _roeId_: randomId,
            input54358: data1[i]
          };
          if (data2Length !== 0) {
            data2.forEach(row => {
              if (row.input54358 === subFormRowData.input54358) {
                subFormRowData.selectuser17630 = row.selectuser17630;
                subFormRowData.radio28579 = row.radio28579;
                subFormRowData.input67563 = row.input67563;
                subFormRowData.fileupload86519 = row.fileupload86519;
              }
            })
          }
          saveData.push(subFormRowData);
        }
      }
      for (var i = 0; i < data2Length; i++) {
        this.getWidgetRef('subform44512').deleteSubFormRow(0);
      }
      if (saveData.length > 0) {
        this.getWidgetRef('subform44512').insertSubFormRow(0, false, null, saveData);
      }
    },
    /* ECR变更 */
    /* 指定管理方法 */
    async showdialog(status) {
      this.showdialogdata.form = {
        devcode: '',
        appointtype: '',
        orderno: '',
        orderitemno: '',
        endtime: ''
      }
      // 4. 设置标题
      if (status == 'insert') {
        this.showdialogdata.form = {}
        this.showdialogdata.form.demandtype = '新增';
        this.showdialogdata.title = '新增指定';
      } else {
        this.showdialogdata.form.demandtype = '修改';
        this.showdialogdata.title = '修改指定';
        let dataid = this.getWidgetRef('subform67098').selectedRowData;
        this.updateSelectDataId = dataid[0];
        if (dataid.length !== 1) {
          this.$message.warning('请选择一条数据');
          return;
        } else {
          this.showdialogdata.form = {}
          this.getWidgetRef('subform67098').getSubFormValues().forEach(row => {
            console.log("di1", row._rowId_);
            console.log("di1", dataid[0]);
            if (row._rowId_ == dataid[0]) {
              this.showdialogdata.form = {
                rowId: dataid[0],//id
                demandtype: '修改', // 操作
                customercode: row.input75631, // 客户编码
                customername: row.input94778, // 客户名称
                devcode: row.input80138, // 开发令
                ProductType: row.input11655, // 机型
                materialcode: row.input66947, // 物料编码
                materialname: row.input20325, // 物料名称
                suppliercode: row.input80487, // 供应商编码
                suppliername: row.input7629,  // 供应商名称
                orderno: row.input21986, // 订单号
                appointtype: row.input68758, // 指定类型
                endtime: row.input111716, // 结束日期
                orderitemno: row.input112797, // 项次
                takeAwayType: row.input94969 // 成品码
              }
            }
          })
          console.log("数据", this.showdialogdata.form);
        }
      }
      this.showdialogdata.dialogVisible = true;
      // 获取开发令
      let data = await api.get('/attributecard/v1/queryAttrCardDetail');
      var dataKey = Object.keys(data.data.data.devCodeAndProductType);
      var datavaluse = Object.values(data.data.data.devCodeAndProductType);
      var Object1 = [];
      for (var i = 0; i < dataKey.length; i++) {
        Object1.push({ devCode: dataKey[i], ProductType: datavaluse[i] });
      }
      Object1.forEach(row => {
        this.showdialogdata.option.push(row);
      });
      console.log(this.showdialogdata.option);
      //获取客户名称
      data = await api.get('/process/v1/getClientCodeList');
      console.log("data", data.data.data);
      data.data.data.forEach(row => {
        this.showdialogdata.option1.push(row);
      })
      //获取物料码
      // data = await api.get('/change/getMaterialOrDrawNo?code=&type=MaterialCode');
      const res = await api.get('/change/getMaterialOrDrawNo', {
        params: {
          code: "88007",
          type: 'MaterialCode'
        }
      }
      );
      console.log("res", res.data.data);
      this.showdialogdata.option2 = res.data.data;
      console.log("this.showdialogdata.form.materialcode", this.showdialogdata.form.materialcode);
    },
    /* 指定管理方法 */
    async showdingAffectedOrderInformation5(val) {
      this.queryOrderNubmer();
      let selectData2 = "";
      let selectData3 = "";
      let selectData = "";
      let selectData4 = "";
      let query
      if (this.formType === '设计变更表单') {
        let num = val;
        if (num === 1) {
          let selectDataid = this.getWidgetRef('subform47946').selectedRowData;
          if (selectDataid.length !== 1) {
            this.$message.error('请选择一行');
            return;
          }
          console.log(selectDataid);
          let selectAllData = this.getWidgetRef('subform47946').getSubFormValues();
          console.log("selectAllData", selectAllData);
          selectAllData.forEach(item => {
            if (item._rowId_ == String(selectDataid)) {
              selectData = item.input67563;
              selectData2 = item.radio81926  //更改类型
              console.log("selectData", selectData);
            }
          });
          selectData4 = 'PatternCode';
        } else {
          //huangxumin
          let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
          if (selectDataid.length !== 1) {
            this.$message.error('请选择一行');
            return;
          }
          let selectAllData = this.getWidgetRef('subform57714').getSubFormValues();
          selectAllData.forEach(item => {
            if (item._rowId_ == String(selectDataid)) {
              selectData2 = item.input70284  //更改类型
              selectData4 = item.input102173   //更改对象类型
              if (selectData2 == '增加') {
                selectData3 = item.input37516
              } else {
                selectData3 = item.input36063
              }
              selectData = selectData3;
            }
          });
        }
        this.partNumber = selectData;
        query = {
          changeNo: this.changNo,
          [selectData4]: selectData ? [selectData] : [],
          changeType: selectData2
        }
      }
      if (this.formType === '订单更改通知书') {
        let rowId;
        let data;
        let param;
        let param2;
        let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        rowId = this.getWidgetRef('subform57714').selectedRowData;
        console.log("获取选中id", rowId);
        data = this.getWidgetRef('subform57714').getSubFormValues();
        console.log("获取表格中所有的数值", data);
        data.forEach(row => {
          if (row._rowId_ === rowId[0]) {
            // if (row.input10716 === "" || row.input10716 === null || row.input10716 === undefined) {
            //   param = row.input70926;
            //   param2 = row.input102173;
            // } else {
            //   param = row.input10716;
            //   param2 = row.input102173;
            // }
            selectData2 = row.input70284  //更改类型
            selectData4 = row.input102173   //更改对象类型
            if (!row.input36063) {
              param = row.input37516;
              param2 = row.input102173;
            } else {
              param = row.input36063;
              param2 = row.input102173;
            }
          }
        })
        selectData = param;
        selectData4 = param2;
        this.partNumber = selectData;
        query = {
          changeNo: this.changNo,
          [selectData4]: selectData ? [selectData] : [],
          changeType: selectData2
        }
      }
      if (this.formType === '制造BOM改通知单') {
        let rowId;
        let data;
        let param;
        let param2;
        let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        rowId = this.getWidgetRef('subform57714').selectedRowData;
        console.log("获取选中id", rowId);
        data = this.getWidgetRef('subform57714').getSubFormValues();
        console.log("获取表格中所有的数值", data);
        data.forEach(row => {
          if (row._rowId_ === rowId[0]) {
            selectData2 = row.input70284  //更改类型
            selectData4 = row.input102173   //更改对象类型
            if (!row.input36063) {
              param = row.input37516;
              param2 = row.input102173;
            } else {
              param = row.input36063;
              param2 = row.input102173;
            }
          }
        })
        selectData = param;
        selectData4 = param2;
        this.partNumber = selectData;
        query = {
          changeNo: this.changNo,
          [selectData4]: selectData ? [selectData] : [],
          changeType: selectData2
        }
      }
      console.log("query", query);
      const res = await api.post('/change/v1/getChangeImpactMbom', query);
      console.log("res", res.data);
      if (!res.data.data.mbom && !res.data.data.appoint) {
        this.$message.warning('未查询到受影响的指定信息与受影响的成品BOM');
      }
      this.ChangeImpactMbom.mbom = res.data.data.mbom;
      this.ChangeImpactMbom.appoint = res.data.data.appoint;
      this.ChangeImpactMbom.dialogVisible = true;
    },
    ChangeImpactMbomcancel() {
      this.ChangeImpactMbom.dialogVisible = false;
    },
    async ChangeImpactMbomSubmit() {
      if (this.ChangeImpactMbom.appointSelect.length === 0 && this.ChangeImpactMbom.mbomSelect.length === 0) {
        this.$message.warning("请至少选择一条受影响的指定信息或受影响的成品BOM");
        return;
      }
      this.ChangeImpactMbom.appoint = this.ChangeImpactMbom.appointSelect
      this.ChangeImpactMbom.mbom = this.ChangeImpactMbom.mbomSelect
      console.log("ChangeImpactMbom", this.ChangeImpactMbom);
      let chagneNo = this.getWidgetRef('input86681')?.getValue() ?? "";
      if (chagneNo == '')
        chagneNo = this.getWidgetRef('input49400')?.getValue() ?? "";
      if (chagneNo == '')
        chagneNo = this.getWidgetRef('input34374')?.getValue() ?? "";
      if (chagneNo == '')
        chagneNo = this.getWidgetRef('input56967')?.getValue() ?? "";
      let data = {
        partNumber: this.partNumber,
        changeNo: chagneNo,
        appoint: this.ChangeImpactMbom.appoint,
        mbom: this.ChangeImpactMbom.mbom
      }
      console.log("data", JSON.stringify(data));
      try {
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
        const res = await api.post('/change/v1/saveChangeImpactMbom', data);
        this.$message.success("保存成功");
        this.ChangeImpactMbom.dialogVisible = false;

      } catch {
        this.$message.error("保存失败");
      } finally {
        this.closeLoading();
      }
    },
    /* 分页功能 */
    updatePagedData() {
      const start = (this.currentPage - 1) * this.pageSize;
      const end = start + this.pageSize;
      this.pagedData = this.OrderInquiryData.slice(start, end);
      this.pagedDataSelect = this.OrderInquiryData.slice(start, end);
      this.totalRecords = this.OrderInquiryData.length;
    },
    /* 分页功能 */
    /* 加载功能 */
    // 显示加载动画
    showLoading(text = '加载中...', background = 'rgba(0, 0, 0, 0.7)') {
      this.loadingInstance = ElLoading.service({
        lock: true,
        text,
        background: background, // 背景颜色
        customClass: 'custom-loading', // 给 loading 加个自定义类
        spinner: '', // 使用默认的 spinner 图标
      });
    },
    // 关闭loading的方法
    closeLoading() {
      if (this.loadingInstance) {
        this.loadingInstance.close();
      }
    },
    /* 指定管理 */
    //获取开发令
    getChangeImpactMbom() {

    },

    async Changeinformationinputdata99(query) {
      const objectType = this.formData.selectObjectType;
      if (objectType === undefined || objectType === null)
        this.$alert('请先选择变更对象类型！', '提示');
      if (query && query.length >= 9 && !this.hasCalled) {
        console.log("输入到9位，调用方法:", query);
        const res = await api.get('/change/queryPartNumberByType', {
          params: {
            code: query,
            type: objectType,
          }
        }
        );
        let data = res.data.data;
        console.log(data);
        this.options10 = Object.keys(data).map(key => ({
          value: res.data.data[key].number,
          label: res.data.data[key].name
        }));
        console.log("下拉框的值", this.options10);
      }

    },
    /* 受影响BOM */
    showAffectedBOMfunction() {
      this.Affectedbomdetailstable = [];
      if (this.formData.selectType == '增加') {
        console.log("增加", this.Changeinformationinputdata.input5);
        if (this.Changeinformationinputdata.input5 === "" || this.Changeinformationinputdata.input5 === null || this.Changeinformationinputdata.input5 === undefined) {
          this.$message.warning("请输入变更后图样代号");
          return;
        }
        this.showAffectedBOM = true
      } else {
        if (this.Changeinformationinputdata.input2 === "" || this.Changeinformationinputdata.input2 === null || this.Changeinformationinputdata.input2 === undefined) {
          this.$message.warning("请输入变更前图样代号");
          return;
        }
        this.AffectedBomdetailsinquiry();
      }


    },
    handlePageChange(currentPage) {
      this.currentPage = currentPage;
      this.updatePagedData();
    },
    handleSizeChange(pageSize) {
      this.pageSize = pageSize;
      this.currentPage = 1; // 重置页码
      this.updatePagedData();
    },
    updatePageData() {
      const start = (this.currentPage - 1) * this.pageSize;
      const end = start + this.pageSize;
      this.currentPageData = this.OrderInquiryData.slice(start, end);
    },

    /* 订单查询分页功能 */
    //自动填写提出单位
    async getCustomer() {
      try {
        const res = await api.get('/change/v1/getOrgNameByUser', {
          params: {
            oid: ""  // 如果需要传 oid，这里补上值
          }
        });
        // 安全取值
        const orgName = res?.data?.data || '';
        console.log("变更单号：", orgName);
        if (orgName !== '') {
          this.isGetCustomer = false;
        }
        //huangxumin 
        // 设置到 input 设计变更提出部门
        this.getWidgetRef('input101393').setValue(orgName);
        //客户ECR提出部门
        this.getWidgetRef('input85601').setValue(orgName);
      } catch (error) {
        // console.error("请求失败:", error);
        // this.$message.error("获取客户信息失败");
      }
    },
    //
    async Changeinformationinputdata9(query) {
      if (query && query.length >= 9 && !this.hasCalled) {
        console.log("输入到9位，调用方法:", query);
        const res = await api.get('/change/getMaterialOrDrawNo', {
          params: {
            code: query,
            type: 'MaterialCode'
          }
        }
        );
        let data = res.data.data;
        console.log(data);
        this.options = Object.keys(data).map(key => ({
          value: res.data.data[key].number,
          label: res.data.data[key].name
        }));
        console.log("下拉框的值", this.options);
      }
    },
    async Changeinformationinputdata92(query) {
      const objectType = this.formData.selectObjectType;
      if (objectType === undefined || objectType === null)
        this.$alert('请先选择变更对象类型！', '提示');
      if (query && query.length >= 9 && !this.hasCalled) {
        console.log("输入到9位，调用方法:", query);
        console.log("objectType:", objectType);
        const res = await api.get('/change/queryPartNumberByType', {
          params: {
            code: query,
            type: objectType
          }
        }
        );
        let data = res.data.data;
        console.log(data);
        this.options1 = Object.keys(data).map(key => ({
          value: res.data.data[key].number,
          label: res.data.data[key].name
        }));
        console.log("下拉框的值", this.options1);


      }
    },
    async Changeinformationinputdata93(query) {
      if (query && query.length >= 9 && !this.hasCalled) {
        console.log("输入到9位，调用方法:", query);
        const res = await api.get('/change/getMaterialOrDrawNo', {
          params: {
            code: query,
            type: 'PatternCode'
          }
        }
        );
        let data = res.data.data;
        console.log(data);
        this.options2 = Object.keys(data).map(key => ({
          value: res.data.data[key].number,
          label: res.data.data[key].name
        }));
        console.log("下拉框的值", this.options2);
      }
    },
    //库存查询图样代号输入
    async PatternCodeSelect9(query) {
      if (query && query.length >= 9 && !this.hasCalled) {
        console.log("输入到9位，调用方法:", query);
        //图样代号
        const res = await api.get('/change/getMaterialOrDrawNo', {
          params: {
            code: query,
            type: 'PatternCode'
          }
        });
        console.log(res.data.data);
        this.queryPartInventoryParam1.PatternCode = res.data.data;
      }
    },
    async MaterialCodeSelect9(query) {
      if (query && query.length >= 9 && !this.hasCalled) {
        console.log("输入到9位，调用方法:", query);
        //物料码
        const res1 = await api.get('/change/getMaterialOrDrawNo', {
          params: {
            code: query,
            type: 'MaterialCode'
          }
        });
        console.log(res1.data.data);
        this.queryPartInventoryParam1.MaterialCode = res1.data.data;
      }
    },
    //库存查询保存方法
    async savePartInventory() {
      this.queryOrderNubmer();
      try {
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
        this.dialog.affectedOrderInformation9 = false;
        this.OurPartInventory.changeNo = this.changNo;
        this.OurPartInventory.inventory = this.PartInventoryselectedRows;
        this.OurPartInventory.partNumbers = [];
        console.log(this.queryPartInventoryParam.PatternCode);
        if (Array.isArray(this.queryPartInventoryParam.PatternCode)) {
          this.queryPartInventoryParam.PatternCode.forEach(row => {
            this.OurPartInventory.partNumbers.push(
              {
                number: row,
                type: "PatternCode"
              }
            );
          });
        }
        console.log(this.queryPartInventoryParam.MaterialCode);
        if (Array.isArray(this.queryPartInventoryParam.MaterialCode)) {
          this.queryPartInventoryParam.MaterialCode.forEach(row => {
            this.OurPartInventory.partNumbers.push(
              {
                number: row,
                type: "MaterialCode"
              }
            )
          });
        }
        const res = await api.post('/change/v1/savePartInventory', this.OurPartInventory);
        console.log(res);
        this.$message.success("保存成功");
      } catch { }
      finally {
        this.closeLoading();
      }
    },
    //库存查询全选方法
    toggleSelection() {
      if (this.PartInventoryselectedRows.length === this.PartInventory.length) {
        this.$refs.tableRef.clearSelection(); // 全部取消
      } else {
        this.PartInventory.forEach(row => {
          this.$refs.tableRef.toggleRowSelection(row, true); // 全部选中
        });
      }
    },
    //库存查询选中保存
    handleSelectionChange10(val) {
      this.PartInventoryselectedRows = val;
      console.log("当前选中行：", this.PartInventoryselectedRows);
    },
    //库存查询查询方法
    async queryPartInventory(param) {
      this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)');
      // this.queryPartInventoryParam.MaterialCode.push(this.MaterialCode);
      // this.queryPartInventoryParam.PatternCode.push(this.PatternCode);
      try {
        console.log("提交的参数:", JSON.stringify(this.queryPartInventoryParam));
        const res = await api.post('/change/v1/queryPartInventory', this.queryPartInventoryParam);
        console.log("res", res.data);
        this.PartInventory = res.data.data;
        console.log("库存查询出参:", this.PartInventory);
        if (this.PartInventory.length === 0) {
          this.$message.warning("未查询到库存");
        }
      } catch (e) {

      } finally {
        this.closeLoading();
      }
    },
    //数字不可以小于0
    validateNumber(type) {
      let value = ''
      if (type === 1) {
        value = this.Changeinformationinputdata.input3
      } else if (type === 2) {
        value = this.Changeinformationinputdata.input6
      }

      if (value === '' || value === null || value === undefined) {
        return
      }

      const num = Number(value)

      if (isNaN(num)) {
        this.$message.error('请输入有效的数字')
        if (type === 1) this.Changeinformationinputdata.input3 = ''
        if (type === 2) this.Changeinformationinputdata.input6 = ''
      } else if (num <= 0) {
        this.$message.error('输入的数值必须大于 0')
        if (type === 1) this.Changeinformationinputdata.input3 = ''
        if (type === 2) this.Changeinformationinputdata.input6 = ''
      }
    },
    //改后零件名称
    handleMaterialChange(val) {
      // val 是选中的物料号
      const selected = this.options1.find(item => item.value === val);
      if (selected) {
        // 自动赋值到零件名称输入框
        this.Changeinformationinputdata.input8 = selected.label;
      } else {
        this.Changeinformationinputdata.input8 = "";
      }
    },
    //改前零件名称
    handleMaterialChange1(val) {
      // val 是选中的物料号
      const selected = this.options10.find(item => item.value === val);
      if (selected) {
        // 自动赋值到零件名称输入框
        this.Changeinformationinputdata.input7 = selected.label;
      } else {
        this.Changeinformationinputdata.input7 = "";
      }
    },
    //关联变更替换件分析
    deleteshowAffectedBom() {
      this.changeObject1 = this.changeObject1.filter(
        item => !this.Relatedchangereplacementpartstableselectdata.affectBOM.includes(item))
    },
    //删除受影响BOM详情
    DeleteAffectedBomDetails() {
      this.Affectedbomdetailstable = this.Affectedbomdetailstable.filter(
        item => !this.Affectedbomdetailsselectdata.includes(item))
    },
    isEmpty(value) {
      return value === null || value === undefined || value === '';
    },
    areAllFiltersEmpty(filters) {
      // 遍历filters的每个属性
      for (let key in filters) {
        if (filters.hasOwnProperty(key) && !this.isEmpty(filters[key])) {
          // 如果有任何属性不为空，返回true
          return true;
        }
      }
      // 如果所有属性都为空，返回false
      return false;
    },
    //受影响BOM详情查询
    async AffectedBomdetailsinquiry() {
      this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
      this.Affectedbomdetailstable = [];
      this.filters.type = this.formData.selectObjectType;
      this.filters.changeStyle = this.formData.selectType;
      let data = [];
      if (this.formData.selectType == '增加') {
        try {
          if (!this.areAllFiltersEmpty(this.filters)) {
            this.$message.warning("请输入查询条件");
            return;
          }
          this.filters.partNumber = this.Changeinformationinputdata.input5;
          this.filters.segmNum = this.Changeinformationinputdata.input4;
          console.log(JSON.stringify(this.filters))
          const res = await api.post('/change/queryAffectBOM', this.filters);
          data = res.data.data;
          console.log("增加时查到的数据", res.data.data);
          if (Array.isArray(data) && data.length === 0) {
            this.$message.warning("未查询到受影响BOM");
            return;
          }
          this.Affectedbomdetailstable = data;
          console.log("Affectedbomdetailstable", this.Affectedbomdetailstable);
        } catch (error) {
          console.log(error);
        } finally {
          this.closeLoading();
        }
      } else {
        this.filters.partNumber = this.Changeinformationinputdata.input2;
        this.filters.segmNum = this.Changeinformationinputdata.input1;
        data = [];
        try {
          const res = await api.post('/change/queryAffectBOM', this.filters);
          data = res.data.data;
          console.log("查到的数据", data);
        } catch { }
        finally {
          this.closeLoading();
          this.showAffectedBOM = true
        }
        this.Affectedbomdetailstable = data;
        if (data.length === 0) {
          this.$message.warning("未查询到受影响BOM");
          return;
        }
      }
    },

    //关联变更详情关闭时调用方法
    handleClose() {
      this.changeObject2 = [],
        this.finishedBOM2 = [],
        this.appoint2 = [],
        this.ebom2 = [],
        this.DrawingDocument2 = [],
        this.inventory2 = [],
        this.module2 = [],
        this.authentication2 = []
    },
    //成品码查询生成格式化字符串
    async OrderInquirySubform() {
      try {
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading

        // 检查是否有选中的数据或表格数据
        let selectedData = this.selectedChangeObjectRows && this.selectedChangeObjectRows.length > 0
          ? this.selectedChangeObjectRows
          : this.OrderInquiryData && this.OrderInquiryData.length > 0
            ? this.OrderInquiryData
            : [];

        if (selectedData.length === 0) {
          this.$message.warning('请先选择或查询数据');
          return;
        }

        // 按订单号分组数据
        const groupedByOrder = {};
        selectedData.forEach(item => {
          const orderNumber = item.orderNumber;
          if (!groupedByOrder[orderNumber]) {
            groupedByOrder[orderNumber] = [];
          }
          // 收集项次
          if (item.itemSequence) {
            groupedByOrder[orderNumber].push(item.itemSequence);
          }
        });

        // 生成格式化字符串列表
        const formattedStrings = [];
        for (const orderNumber in groupedByOrder) {
          if (groupedByOrder.hasOwnProperty(orderNumber)) {
            // 将项次用斜杠连接
            const itemSequences = groupedByOrder[orderNumber].join('/');
            // 格式化为：订单号项次 项次列表
            const formattedValue = `${orderNumber}项次 ${itemSequences}`;
            formattedStrings.push(formattedValue);
          }
        }

        let i = 0;
        //拼接test

        formattedStrings.forEach(item => {
          let randomId = 'id' + Math.floor(Math.random() * 1000000);
          let subFormRowData = {
            _rowId_: randomId,
            // input62290: test + ",",
            input55371: item,

          };
          this.getWidgetRef('subform77630').insertSubFormRow(0, false, null, [subFormRowData]);
        })

        // 用换行符连接所有字符串
        const resultString = formattedStrings.join(',');
        this.getWidgetRef('input95723').setValue(resultString);
        // 显示生成的字符串
        this.$message.success('字符串已生成，请查看控制台输出');

        // 关闭对话框
        this.dialog.affectedOrderInformationXQB = false;
      } catch (error) {
        console.error('生成格式化字符串失败:', error);
        this.$message.error('生成字符串失败，请重试');
      } finally {
        // 确保关闭loading
        this.closeLoading();
      }
    },
    //将选中信息添加到变更单
    async OrderInquiryMain() {
      this.queryOrderNubmer();
      try {
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
        let test = "";
        let secnumber = "";
        let materialcode = "";
        let quantity = "";
        let PatternCode = "";
        let customer = "";
        let model = "";
        let randomId = 'id' + Math.floor(Math.random() * 1000000);
        let i = 0;
        //拼接test
        this.selectedChangeObjectRows.forEach(row => {
          if (i === 0) {
            test = row.ordernumber + "-" + row.itemno;
            secnumber = row.secnumber;
            materialcode = row.materialcode;
            quantity = row.quantity;
            PatternCode = row.patterncode;
            customer = row.customer;
            model = row.model;
            i += 1;
          } else {
            let test1 = row.ordernumber + "-" + row.itemno;
            test = test + "," + test1
          }
        });
        const subFormRowData = {
          _rowId_: randomId,
          // input62290: test + ",",
          input62290: test,
          input46850: secnumber,
          input107035: this.PatternCode ? this.PatternCode : this.MaterialCode,
          number40456: quantity,
          input29068: this.PatternCode ? "1" : "2"
        };
        console.log("subFormRowData", subFormRowData);
        if (this.formType === '设计变更表单') {
          console.log(subFormRowData);
          var saveType = "新增";
          var returnedData = JSON.parse(JSON.stringify(this.getWidgetRef('subform90577').getSubFormValues()));
          var returnedDataLength = returnedData.length;
          for (let i = 0; i < returnedData.length; i++) {
            if (returnedData[i].input107035 === subFormRowData.input107035) {
              // returnedData[i] = subFormRowData
              // returnedData.splice(i, 1, subFormRowData);
              saveType = "替换"
              break;
            }
          }
          if (saveType === "新增") {
            returnedData.push(subFormRowData);
          }
          for (let i = 0; i < returnedDataLength; i++) {
            this.getWidgetRef('subform90577').deleteSubFormRow(0);
          }
          console.log("returneData", returnedData);
          returnedData.forEach(row => {
            this.getWidgetRef('subform90577').insertSubFormRow(0, false, null, [row]);
          })
          // this.getWidgetRef('subform90577').insertSubFormRow(0, false, null, returnedData);
        } else if (this.formType === '订单更改通知书') {
          console.log("test", test);
          console.log("model", model);
          this.OrderSelect.input36906 = test;
          console.log("OrderSelect", this.OrderSelect);
          this.OrderSelect.input80631 = model;
          let data1 = this.getWidgetRef('subform57714').getSubFormValues();
          let indexcopy;
          data1.forEach((row, index) => {
            if (row._rowId_ === this.OrderSelect._rowId_) {
              data1[index] = this.OrderSelect;
              indexcopy = index;
            }
          })
          this.getWidgetRef('subform57714').updateRowWithoutRender(data1, indexcopy);
        } else if (this.formType === '制造BOM改通知单') {
          console.log("test", test);
          console.log("model", model);
          this.OrderSelect.input36906 = test;
          console.log("OrderSelect", this.OrderSelect);
          this.OrderSelect.input80631 = model;
          let data1 = this.getWidgetRef('subform57714').getSubFormValues();
          let indexcopy;
          data1.forEach((row, index) => {
            if (row._rowId_ === this.OrderSelect._rowId_) {
              data1[index] = this.OrderSelect;
              indexcopy = index;
            }
          })
          this.getWidgetRef('subform57714').updateRowWithoutRender(data1, indexcopy);
        }
        var query = {};
        var orderList = [];
        if (this.PatternCode !== "" && this.PatternCode !== undefined) {
          this.selectedChangeObjectRows.forEach(row => {
            row.changeno = this.changeno;
            row.partnumber = this.PatternCode;
            row.parttype = "PatternCode";
            orderList.push(row);
          })
          query = {
            changeNo: this.changNo,
            partNumbers: [
              {
                number: this.PatternCode,
                type: "PatternCode"
              }
            ],
            orderList: orderList
          };
        } else {
          this.selectedChangeObjectRows.forEach(row => {
            row.changeno = this.changeno;
            row.partnumber = this.MaterialCode;
            row.parttype = "MaterialCode";
            orderList.push(row);

          })
          query = {
            changeNo: this.changNo,
            partNumbers: [
              {
                number: this.MaterialCode,
                type: "MaterialCode"
              }
            ],
            orderList: orderList
          };
        }
        this.MaterialCode = "";
        this.PatternCode = "";
        console.log(JSON.stringify(query));
        const res = await api.post('/change/v1/saveProductOrderList', query);

        console.log(res);
        this.$message.success("保存成功");
        this.dialog.affectedOrderInformation = false;

        this.selectedChangeObjectRows = [];
      } catch (error) {
        console.log(error);
      } finally {
        this.closeLoading();
      }
    },
    //打开订单查询界面方法
    async showdingAffectedOrderInformation9() {
      this.queryOrderNubmer();
      /* if (this.formType === '客户ECR表单') {
        let data;
        let param;
        let selectDataid = this.getWidgetRef('subform47946').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        data = this.getWidgetRef('subform47946').getSubFormValues();
        console.log("获取表格中所有的数值", data);
        data.forEach(row => {
          if (row._rowId_ === selectDataid[0]) {
            param = row.input91754;
          }
        })
        this.queryPartInventory(param)
      } else if (this.formType === '订单更改通知书') {
        let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        let rowId;
        let data;
        let param;
        rowId = this.getWidgetRef('subform57714').selectedRowData;
        console.log("获取选中id", rowId);
        data = this.getWidgetRef('subform57714').getSubFormValues();
        console.log("获取表格中所有的数值", data);
        data.forEach(row => {
          if (row._rowId_ === rowId[0]) {
            // if (!row.input10716) {
            //   param = row.input70926;
            // } else {
            //   param = row.input10716;
            // }
            if (!row.input36063) {
              param = row.input37516;
            } else {
              param = row.input36063;
            }
          }
        })
        console.log("传入的参数为", param);
        this.queryPartInventory(param)
      } else if (this.formType === '制造BOM改通知单') {
        let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        let rowId;
        let data;
        let param;
        rowId = this.getWidgetRef('subform57714').selectedRowData;
        console.log("获取选中id", rowId);
        data = this.getWidgetRef('subform57714').getSubFormValues();
        console.log("获取表格中所有的数值", data);
        data.forEach(row => {
          if (row._rowId_ === rowId[0]) {
            if (!row.input36063) {
              param = row.input37516;
            } else {
              param = row.input36063;
            }
          }
        })
        console.log("传入的参数为", param);
        this.queryPartInventory(param)
      } */
      this.dialog.affectedOrderInformation9 = true;
    },
    //打开关联变更件替换说明
    async showdingAffectedOrderInformation20() {
      this.queryOrderNubmer();
      try {
        let selectData1 = "";
        let selectData2 = "";
        let selectData3 = "";
        let selectData4 = "";
        let selectData5 = "";
        let selectData6 = "";
        let selectData7 = "";
        let selectData8 = "";
        let selectData9 = "";
        let selectData10 = "";
        let param = {};
        let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        let selectAllData = this.getWidgetRef('subform57714').getSubFormValues();
        selectAllData.forEach(row => {
          if (row._rowId_ === selectDataid[0]) {
            param = row;
          }
        })

        console.log("selectAllData", selectAllData);
        selectData1 = param.input17383  //改前零件名称
        selectData2 = param.input70284  //更改类型
        selectData3 = param.input36063  //改前图样代号、物料码
        selectData4 = param.input64759  //改前数量
        selectData5 = param.input37516  //改后图样代号、无聊码
        selectData6 = param.input51620  //改后零件名称
        selectData7 = param.input58662  //改后数量
        selectData8 = param.input69053  //改前代码段
        selectData9 = param.input59564  //改后代码段
        selectData10 = param.input102173

        if (selectData2 == '增加') {
          selectData3 = selectData5;
          selectData8 = selectData9
        }
        console.log(selectData3);
        console.log(this.changeNo);
        const res = await api.get('/change/querySaveAffectBOM', {
          params: {
            partNo: selectData3,
            changeNo: this.changNo,
            changeStyle: selectData2,
            partType: selectData10,
            segmNum: selectData8
          }
        });
        this.changeObject21 = res.data.data;
        console.log("res.data.data", res.data.data)
        this.dialog.affectedOrderInformation20 = true;
        this.Changeinformationinputdata1.input1 = selectData2
        this.Changeinformationinputdata1.input2 = selectData8
        this.Changeinformationinputdata1.input3 = selectData3
        this.Changeinformationinputdata1.input4 = selectData1
        this.Changeinformationinputdata1.input5 = selectData4
        this.Changeinformationinputdata1.input6 = selectData9
        this.Changeinformationinputdata1.input7 = selectData5
        this.Changeinformationinputdata1.input8 = selectData6
        this.Changeinformationinputdata1.input9 = selectData7
        this.activeCollapse2 = this.changeObject15;
      } catch (error) {
        console.log(error);
      }
    },
    //获取成品码
    async obtainTheFinishedProductCode() {
      try {
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)');
        const res = await api.post('/rtcfgdspfdemandmain/v1/getTransitOrder', {
          mBomCode: this.mBomCode
        });

        // 适配新的返回值格式
        if (res.data.result === 'SUCCESS' && res.data.code === '200') {
          this.OrderInquiryData = res.data.data || [];
          this.$message.success(res.data.orderID || '获取成功');
        } else {
          this.OrderInquiryData = [];
          this.$message.warning('未获取到数据');
        }
        this.updatePagedData(); // 更新分页
      } catch (error) {
        console.error(error);
        this.$message.error("查询失败");
      } finally {
        // 确保无论请求是否成功都关闭 loading
        this.closeLoading();
      }
    },
    //查询界面订单查询方法
    async getOrderInquiry(param1) {
      this.queryOrderNubmer();
      try {
        var res;
        if (param1 === "1") {
          res = await api.post('/change/v1/queryProductOrderList', {
            changeNo: this.changNo,
            PatternCode: this.PatternCode ? [this.PatternCode] : [],
            MaterialCode: this.MaterialCode ? [this.MaterialCode] : [],
            type: "save",
          });
          this.PatternCode = "";
          this.MaterialCode = "";
        } else {
          this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)');
          res = await api.post('/change/v1/queryProductOrderList', {
            changeNo: this.changNo,
            PatternCode: this.PatternCode ? [this.PatternCode] : [],
            MaterialCode: this.MaterialCode ? [this.MaterialCode] : [],
            type: "",
          });
        }
        this.OrderInquiryData = res.data.data || [];
        this.updatePagedData(); // 更新分页
      } catch (error) {
        console.error(error);
        this.$message.error("查询失败");
      } finally {
        // 确保无论请求是否成功都关闭 loading
        this.closeLoading();
      }
    },
    // 变更订单查询
    async getOrderInquiry1() {

    },
    //关联变更代替说明
    async showdingAffectedOrderInformation4() {
      this.queryOrderNubmer();
      this.dialog.affectedOrderInformation4 = true;
      try {
        // 段号获取
        let res = await api.get('/bom/getRtSegmNum');
        let data = res.data.data;
        this.options2 = Object.keys(data).map(key => ({
          value: key,
          label: res.data[key]
        }));
        console.log(this.options2);
      } catch (error) {
        console.log(error);
      }
    },
    handleSelectionChange19(selection, str) {
      if (str == 'appoint') {
        this.ChangeImpactMbom.appointSelect = selection
        console.log(this.ChangeImpactMbom.appointSelect);
      } else {
        this.ChangeImpactMbom.mbomSelect = selection
        console.log(this.ChangeImpactMbom.mbomSelect);
      }
    },
    //储存变更对象中选中的值
    handleSelectionChange(selection) {
      this.selectedChangeObjectRows = selection;
      console.log('选中的行数据：', selection);
      console.log('选中数量：', selection.length);

      // 确保数据正确传递
      if (selection && selection.length > 0) {
        console.log('第一条数据示例：', selection[0]);
      }
    },
    //影响分析选中方法
    handleSelectionChange1(selection, str) {
      this.ChangeImpactAnalysis[str] = selection
      console.log(this.ChangeImpactAnalysis[str])
    },
    //受影响BOM详情选中方法
    handleSelectionChange2(selection) {
      this.Affectedbomdetailsselectdata = selection;
    },
    //关联变更替换件表格选中方法
    handleSelectionChange3(selection) {
      this.Relatedchangereplacementpartstableselectdata.affectBOM = selection;
      console.log('选中的行数据：', this.Relatedchangereplacementpartstableselectdata);
    },

    async openChangeDetail(MaterialCode) {
      this.queryOrderNubmer();
      try {
        if (this.formType === '订单更改通知书') {
          if (!MaterialCode.isTrusted) {
            this.MaterialCode = MaterialCode;
          }
        }
        console.log("this.formType", this.formType);
        if (this.formType === 5) {
          if (!MaterialCode.isTrusted) {
            this.PatternCode = MaterialCode;
          }
        }
        let query = {
          changeNo: this.changNo,
          PatternCode: this.PatternCode ? [this.PatternCode] : [],
          MaterialCode: this.MaterialCode ? [this.MaterialCode] : [],
        }
        console.log("query:", JSON.stringify(query));
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
        console.log("123");
        const res = await api.post('/change/getChangeImpactAnalysis', query);
        const data = res.data.data;
        this.changeObject = data.changeObject || [];
        this.finishedBOM = data.FinishedBOM || [];
        this.appoint = data.appoint || [];
        this.ebom = data.EBOM || [];
        this.DrawingDocument = data.DrawingDocument || [];
        this.authentication = data.authentication || [];
        this.module = data.module || [];
        this.dialogVisible = true;
        console.log("data", data);
      } catch (error) {
        this.$message.error("请输入正确图样代号或物料码");
      } finally {
        // 确保无论请求是否成功都关闭 loading
        this.closeLoading();
      }
    },
    showdingAffectedOrderInformationSelect() {
      this.queryOrderNubmer();
      if (this.formType = '订单更改通知单') {
        var selectRow = this.getWidgetRef('subform57714').selectedRowData;
        let data = this.getWidgetRef('subform57714').getSubFormValues();
        if (selectRow.length !== 1) {
          this.$message.warning("请选择一行查看订单详情");
          return;
        }
        for (var i = 0; i < data.length; i++) {
          if (data[i]._rowId_ === selectRow[0]) {
            this.MaterialCode = data[i].input36063 ? data[i].input36063 : input37516;
          }
        }
        this.getOrderInquiry("1");
        this.dialog.affectedOrderInformationSelect = true;
      } else if (this.formType = '设计变更表单') {
        var selectRow = this.getWidgetRef('subform90577').selectedRowData;
        let data = this.getWidgetRef('subform90577').getSubFormValues();
        if (selectRow.length !== 1) {
          this.$message.warning("请选择一行查看订单详情");
          return;
        }
        for (var i = 0; i < data.length; i++) {
          if (data[i]._rowId_ === selectRow[0]) {
            if (data[i].input29068 === "1") {
              this.PatternCode = data[i].input107035;
            } else {
              this.MaterialCode = data[i].input107035;
            }
          }
        }
        this.getOrderInquiry("1");
        this.dialog.affectedOrderInformationSelect = true;
      } else if (this.formType = '制造BOM改通知单') {
        var selectRow = this.getWidgetRef('subform57714').selectedRowData;
        let data = this.getWidgetRef('subform57714').getSubFormValues();
        if (selectRow.length !== 1) {
          this.$message.warning("请选择一行查看订单详情");
          return;
        }
        for (var i = 0; i < data.length; i++) {
          if (data[i]._rowId_ === selectRow[0]) {
            this.MaterialCode = data[i].input36063 ? data[i].input36063 : input37516;
          }
        }
        this.getOrderInquiry("1");
        this.dialog.affectedOrderInformationSelect = true;
      }
    },
    //更改请求变更单号
    showdingAffectedOrderInformation1() {
      this.dialog.affectedOrderInformation1 = true;

    },
    //订单查询
    showdingAffectedOrderInformation() {
      this.queryOrderNubmer();
      if (this.formType === '制造BOM改通知单') {
        console.log("进来了");
        let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        console.log("selectedRowData", selectDataid);
        let data = this.getWidgetRef('subform57714').getSubFormValues();
        data.forEach(row => {
          if (row._rowId_ === selectDataid[0]) {
            this.OrderSelect = row;
          }
        })
        if (this.OrderSelect.input36063) {
          this.MaterialCode = this.OrderSelect.input36063;
          this.getOrderInquiry();
        } else {
          this.MaterialCode = this.OrderSelect.input37516;
          this.getOrderInquiry();
        }

      }
      if (this.formType === '订单更改通知书') {
        let selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        console.log("selectedRowData", selectDataid);
        let data = this.getWidgetRef('subform57714').getSubFormValues();
        data.forEach(row => {
          if (row._rowId_ === selectDataid[0]) {
            this.OrderSelect = row;
          }
        })
        if (this.OrderSelect.input36063) {
          this.MaterialCode = this.OrderSelect.input36063;
          this.getOrderInquiry();
        } else {
          this.MaterialCode = this.OrderSelect.input37516;
          this.getOrderInquiry();
        }

      }
      this.dialog.affectedOrderInformation = true;
      // 重置分页状态
      this.OrderInquiryData = [];
      this.pagedData = [];
      this.totalRecords = 0;
      this.currentPage = 1;
      this.selectedRows = [];
    },
    async showdingAffectedOrderInformation2() {
      this.changNo = this.getWidgetRef('input86681').getValue();
      this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
      try {
        console.log("this.changNo:", this.changNo);
        const res = await api.get("/change/collectModels", {
          params: { changeNo: this.changNo }
        });
        const keys = Object.keys(res.data.data);
        let rowId = [];
        rowId = this.getWidgetRef('subform63964').rowIdDataShow;
        console.log(rowId);
        rowId.forEach(row => {
          this.getWidgetRef('subform63964').deleteSubFormRow(row);
        });
        Object.entries(res.data.data).forEach(([key, value]) => {
          console.log("123", key, value);
          const randomId = 'id' + Math.floor(Math.random() * 1000000);
          const subFormRowData = {
            _rowId_: randomId,
            input100132: key || '',
            input96010: value || ''
          };
          this.getWidgetRef('subform63964').insertSubFormRow(0, false, null, [subFormRowData]);
          console.log("添加成功");
        });

      } catch (error) {
        console.log(error);
      } finally {
        // 确保无论请求是否成功都关闭 loading
        this.closeLoading();
      }
    },

    async showdingAffectedOrderInformation7(val) {
      this.queryOrderNubmer();
      console.log("变更单号", this.changNo);
      let selectData = "";
      if (val == 1) {
        const selectDataid = this.getWidgetRef('subform47946').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        console.log(selectDataid);
        const selectAllData = this.getWidgetRef('subform47946').getSubFormValues();
        console.log("selectAllData", selectAllData);
        selectAllData.forEach(item => {
          if (item._rowId_ == selectDataid[0]) {
            console.log(item.input67563);
            selectData = item.input67563;
          }
        });
      } else if (val == 2) {
        //huangxumin
        const selectDataid = this.getWidgetRef('subform47946').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        console.log(selectDataid);
        const selectAllData = this.getWidgetRef('subform47946').getSubFormValues();
        console.log("selectAllData", selectAllData);
        selectAllData.forEach(item => {
          if (item._rowId_ == selectDataid[0]) {
            console.log(item.input91754);
            selectData = item.input91754;
          }
        });
      } else if (val == 3) {
        const selectDataid = this.getWidgetRef('subform57714').selectedRowData;
        if (selectDataid.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        let rowId;
        let data;
        let param;
        rowId = this.getWidgetRef('subform57714').selectedRowData;
        console.log("获取选中id", rowId);
        data = this.getWidgetRef('subform57714').getSubFormValues();
        console.log("获取表格中所有的数值", data);
        data.forEach(row => {
          if (row._rowId_ === rowId[0]) {
            if (row.input37516) {
              param = row.input37516;
            } else {
              param = row.input36063;
            }
          }
          selectData = param;
        })
        console.log("传入的参数为", param);

      }
      this.dialog.affectedOrderInformation11 = true;
      try {

        console.log("changNo", this.changNo)
        console.log("selectData", selectData)
        const res = await api.get('/change/getRelateChangeDetail', {
          params: {
            partNo: selectData,
            changeNo: this.changNo
          }
        });
        const data = res.data.data;
        console.log(data);
        this.changeObject2 = data.changeObject || [];
        this.finishedBOM2 = data.FinishedBOM || [];
        this.appoint2 = data.appoint || [];
        this.ebom2 = data.EBOM || [];
        this.DrawingDocument2 = data.DrawingDocument || [];
        this.authentication2 = data.authentication || [];
        this.module2 = data.module || [];
        console.log("module2", this.module2)
      } catch (error) {
        console.log(error);
        this.$message.error(error.message);
      }
    },
    showdingAffectedOrderInformation3(val) {
      this.queryOrderNubmer();
      console.log("测试专用");
      if (this.formType === '订单更改通知书') {
        let rowId;
        let data;
        let param;
        rowId = this.getWidgetRef('subform57714').selectedRowData;
        if (rowId.length !== 1) {
          this.$message.error('请选择一行');
          return;
        }
        console.log("获取选中id", rowId);
        data = this.getWidgetRef('subform57714').getSubFormValues();
        console.log("获取表格中所有的数值", data);
        data.forEach(row => {
          if (row._rowId_ === rowId[0]) {
            if (row.input36063) {
              param = row.input36063;
            } else {
              param = row.input37516;
            }
          }
        })
        this.openChangeDetail(param);
      }
      // if (val === 100) {
      //   let rowId;
      //   let data;
      //   let param;
      //   rowId = this.getWidgetRef('subform47946').selectedRowData;
      //   if (rowId.length !== 1) {
      //     this.$message.error('请选择一行');
      //     return;
      //   }
      //   console.log("获取选中id", rowId);
      //   data = this.getWidgetRef('subform47946').getSubFormValues();
      //   console.log("获取表格中所有的数值", data);
      //   data.forEach(row => {
      //     if (row._rowId_ === rowId[0]) {
      //       param = row.radio73127;
      //     }
      //   })
      //   const result = param.split(',')[0];
      //   this.openChangeDetail(result);
      // }

      this.dialog.affectedOrderInformation3 = true;
    },
    checkIsButton() {
      if (this.field.id === 'input86681') {
        console.log('Y');
        return true;
      }
      return false;
    },

    //订单查询全选
    selectAllRows(refName) {
      this.$refs[refName]?.toggleAllSelection?.();
    },
    selectAllTables() {
      const tableRefs = [
        'orderTable',    // 变更对象
        'orderTable1',   // 受影响的指定信息
        'orderTable2',   // 受影响的EBOM
        'orderTable3',   // 受影响的成品BOM
        'orderTable4',   // 受影响的图文档
        'orderTable6',   // 受影响的模组关系
        'orderTable7'    // 受影响的认证信息
      ];
      tableRefs.forEach(ref => {
        if (this.$refs[ref]) {
          this.$refs[ref].clearSelection();
          this.$refs[ref].toggleAllSelection(); // 全选当前页所有行
        }
      });
    },
    clearAllTables() {
      const tableRefs = [
        'orderTable',    // 变更对象
        'orderTable1',   // 受影响的指定信息
        'orderTable2',   // 受影响的EBOM
        'orderTable3',   // 受影响的成品BOM
        'orderTable4',   // 受影响的图文档
        'orderTable6',   // 受影响的模组关系
        'orderTable7'    // 受影响的认证信息
      ];

      tableRefs.forEach(ref => {
        if (this.$refs[ref]) {
          this.$refs[ref].clearSelection(); // 清空选择
        }
      });
    },
    // 导出
    handleExport(tableRef, fileName) {
      this.exportToExcel(tableRef, fileName);
    },

    // 订单查询导出
    exportData(tableRefKey, fileName) {
      try {
        console.log('开始导出，表格引用键:', tableRefKey);

        // 获取表格引用
        let tableRef = null;
        if (tableRefKey === 'pagedData') {
          tableRef = this.$refs.table;
          console.log('获取到 table 引用:', tableRef);
        } else if (tableRefKey === 'pagedDataSelect') {
          tableRef = this.$refs.pagedDataSelect;
          console.log('获取到 pagedDataSelect 引用:', tableRef);
        }

        if (!tableRef) {
          console.error('表格引用不存在');
          this.$message.warning('表格引用不存在');
          return;
        }

        // 调试信息
        console.log('表格 selection 属性:', tableRef.selection);
        console.log('表格 store 属性:', tableRef.store);

        // 多种方式获取选中数据
        let selectedData = [];

        // 方式1：直接获取 selection
        if (tableRef.selection && tableRef.selection.length > 0) {
          selectedData = tableRef.selection;
          console.log('通过 selection 获取数据:', selectedData);
        }
        // 方式2：通过 store 获取
        else if (tableRef.store && tableRef.store.states) {
          selectedData = tableRef.store.states.selection || [];
          console.log('通过 store 获取数据:', selectedData);
        }
        // 方式3：使用全局的选中数据
        else if (this.selectedChangeObjectRows && this.selectedChangeObjectRows.length > 0) {
          selectedData = this.selectedChangeObjectRows;
          console.log('通过全局选中数据获取:', selectedData);
        }

        if (selectedData.length === 0) {
          this.$message.warning('请先选择要导出的数据');
          return;
        }

        console.log('最终要导出的数据:', selectedData);

        // 准备导出数据
        const exportData = this.prepareExportData(selectedData);

        // 生成Excel文件
        this.generateExcelFile(exportData, fileName, selectedData.length);

      } catch (error) {
        console.error('导出失败:', error);
        this.$message.error('导出失败，请重试');
      }
    },
    prepareExportData(data) {
      return data.map((item, index) => ({
        '序号': index + 1,
        '工厂': item.factory || '',
        '订单号': item.ordernumber || '',
        '项次': item.itemno || '',
        '动力成品码': item.powerproductcode || '',
        '机组成品码': item.crewproductcode || '',
        '段号': item.secnumber || '',
        '图样代号': item.patterncode || '',
        '物料码': item.materialcode || '',
        '物料用量': item.quantity || '',
        '机型': item.model || '',
        '订单数量': item.orderquantity || '',
        '库存': item.inventory || '',
        '工单号': item.ordernumber || '',
        '完工数量': item.completedquantity || '',
        '客户名称': item.customer || '',
        '导出时间': new Date().toLocaleString('zh-CN')
      }));
    },
    generateExcelFile(data, fileName, count) {
      try {
        // 创建工作簿
        const workbook = XLSX.utils.book_new();
        const worksheet = XLSX.utils.json_to_sheet(data);

        // 设置列宽
        if (data.length > 0) {
          const colWidths = Object.keys(data[0]).map(key => ({
            width: Math.max(8, Math.min(25, key.length * 2 + 5))
          }));
          worksheet['!cols'] = colWidths;
        }

        // 添加到工作簿
        XLSX.utils.book_append_sheet(workbook, worksheet, '订单数据');

        // 生成Excel文件
        const excelBuffer = XLSX.write(workbook, {
          bookType: 'xlsx',
          type: 'array'
        });

        const blob = new Blob([excelBuffer], {
          type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
        });

        // 生成文件名（包含时间戳）
        const timestamp = new Date().toISOString().slice(0, 19).replace(/:/g, '-');
        const finalFileName = `${fileName}_${timestamp}.xlsx`;

        // 下载文件
        saveAs(blob, finalFileName);
        this.$message.success(`导出成功，共导出 ${count} 条数据`);

      } catch (error) {
        console.error('生成Excel文件失败:', error);
        this.$message.error('生成Excel文件失败');
      }
    },

    //关联变更替换分析确认
    async onConfirm() {
      this.queryOrderNubmer();
      console.log("变更单号", this.changNo);
      // 生成随机id
      const randomId = 'id' + Math.floor(Math.random() * 1000000);
      let subFormRowData = {};
      let selectdata = Object.values(this.changeObject1);
      let productType = '';
      let customer = '';
      let productCode = '';
      selectdata.forEach(item => {
        let temp1 = item.productType;
        if (productType !== undefined && productType !== null && productType !== '') {
          if (temp1 !== undefined && temp1 !== null && temp1 !== '') {
            productType += "," + temp1;
          }
        } else {
          productType = temp1;
        }
        let temp2 = item.CustomerCode;
        if (customer !== undefined && customer !== null && customer !== '') {
          if (temp2 !== undefined && temp2 !== null && temp2 !== '') {
            customer += "," + temp2;
          }
        } else {
          customer = temp2;
        }
        let temp3 = item.code;
        if (productCode !== undefined && productCode !== null && productCode !== '') {
          if (temp3 !== undefined && temp3 !== null && temp3 !== '') {
            productCode += "," + temp3;
          }
        } else {
          productCode = temp3;
        }
      })
      productType = [...new Set(productType.split(','))].join(',');
      customer = [...new Set(customer.split(','))].join(',');
      if (this.formType == '设计变更表单') {
        console.log("现在为设计变更表单");
        // 组装要写入子表单的一行数据
        subFormRowData = {
          _rowId_: randomId,
          input70284: this.formData.selectType || '',              // 变更类型
          input36063: this.Changeinformationinputdata.input2 || '',              // 改前图号
          input17383: this.Changeinformationinputdata.input7 || '',              // 改前零件名称
          input64759: this.Changeinformationinputdata.input3 || '',              // 改前数量  
          input37516: this.Changeinformationinputdata.input5 || '',              // 改后图号
          input51620: this.Changeinformationinputdata.input8 || '',           // 改后零件名称
          input58662: this.Changeinformationinputdata.input6 || '',           // 改后数量
          input69053: this.Changeinformationinputdata.input1 || '',           // 改前段号
          input59564: this.Changeinformationinputdata.input4 || '',           // 改后段号
          input102173: this.formData.selectObjectType || ''           // 变更对象类型
        };
      } else if (this.formType == '订单更改通知书') {
        console.log("现在为订单更改通知书");
        subFormRowData = {
          _rowId_: randomId,
          input70284: this.formData.selectType || '',
          input69053: this.Changeinformationinputdata.input1 || '',              //改前段号
          input36063: this.Changeinformationinputdata.input2 || '',              // 改前图号
          input64759: this.Changeinformationinputdata.input3 || '',              // 改前数量
          input59564: this.Changeinformationinputdata.input4 || '',              //改后段号
          input37516: this.Changeinformationinputdata.input5 || '',              // 改后图号
          input58662: this.Changeinformationinputdata.input6 || '',              // 改后数量
          input17383: this.Changeinformationinputdata.input7 || '',              // 改后零件名称
          input17383: this.Changeinformationinputdata.input7 || '',              // 改前零件名称


          input77124: productCode, //更改成品码
          input44037: customer, //客户名称
          input80631: productType,
          input102173: this.formData.selectObjectType || ''
        }
      } else if (this.formType == '制造BOM改通知单') {
        console.log("现在为4");
        subFormRowData = {
          _rowId_: randomId,
          input70284: this.formData.selectType || '',
          input69053: this.Changeinformationinputdata.input1 || '',              //改前段号
          input36063: this.Changeinformationinputdata.input2 || '',              // 改前图号
          input64759: this.Changeinformationinputdata.input3 || '',              // 改前数量
          input59564: this.Changeinformationinputdata.input4 || '',              //改后段号
          input37516: this.Changeinformationinputdata.input5 || '',              // 改后图号
          input58662: this.Changeinformationinputdata.input6 || '',              // 改后数量
          input17383: this.Changeinformationinputdata.input7 || '',              // 改后零件名称
          input17383: this.Changeinformationinputdata.input7 || '',              // 改前零件名称
          input77124: productCode, //更改成品码
          input44037: customer, //客户名称
          input80631: productType,
          input102173: this.formData.selectObjectType || ''
        }
      }
      //判断数据是否已添加
      if (!this.Relatedchangereplacementpartstableselectdata.affectBOM) {
        this.$message.warning('请选择变更对象');
        return;
      }
      if (this.formType == '设计变更表单') {
        let arrays = [];
        let arrays1 = [];
        console.log("123", this.Relatedchangereplacementpartstableselectdata.affectBOM);
        this.Relatedchangereplacementpartstableselectdata.affectBOM.forEach(item => {
          arrays1.push(item.CustomerCode);
          arrays.push(item.code);
        })
        let str = arrays.join(",");
        let str1 = arrays1.join(",");
        subFormRowData.input77124 = str;
        subFormRowData.input62875 = str1;
        if (this.getWidgetRef('subform57714').getSubFormValues().some(item =>
          item.input70284 === subFormRowData.input70284 &&
          item.input69053 === subFormRowData.input69053 &&
          item.input36063 === subFormRowData.input36063 &&
          item.input64759 === subFormRowData.input64759 &&
          item.input59564 === subFormRowData.input59564 &&
          item.input58662 === subFormRowData.input58662 &&
          item.input37516 === subFormRowData.input37516 &&
          item.input17383 === subFormRowData.input17383 &&
          item.input51620 === subFormRowData.input51620 &&
          item.input102173 === subFormRowData.input102173
        )) {
          this.$message.warning('数据已添加');
          return;
        }
        console.log("subFormRowData:", subFormRowData);
        this.getWidgetRef('subform57714')?.insertSubFormRow(0, false, null, [subFormRowData]);
      }
      if (this.formType == '订单更改通知书') {
        if (this.getWidgetRef('subform57714').getSubFormValues().some(item =>
          item.input70284 === subFormRowData.input70284 &&
          item.input69053 === subFormRowData.input69053 &&
          item.input36063 === subFormRowData.input36063 &&
          item.input64759 === subFormRowData.input64759 &&
          item.input59564 === subFormRowData.input59564 &&
          item.input58662 === subFormRowData.input58662 &&
          item.input37516 === subFormRowData.input37516)) {
          this.$message.warning('数据已添加');
          return;
        }
        console.log("subFormRowData:", subFormRowData);
        this.getWidgetRef('subform57714')?.insertSubFormRow(0, false, null, [subFormRowData]);
      }
      if (this.formType == '制造BOM改通知单') {
        let arrays = [];
        let arrays1 = [];
        console.log("123", this.Relatedchangereplacementpartstableselectdata.affectBOM);
        this.Relatedchangereplacementpartstableselectdata.affectBOM.forEach(item => {
          arrays1.push(item.CustomerCode);
          arrays.push(item.code);
        })
        let str = arrays.join(",");
        let str1 = arrays1.join(",");
        subFormRowData.input77124 = str;
        subFormRowData.input62875 = str1;
        if (this.getWidgetRef('subform57714').getSubFormValues().some(item =>
          item.input70284 === subFormRowData.input70284 &&
          item.input69053 === subFormRowData.input69053 &&
          item.input36063 === subFormRowData.input36063 &&
          item.input64759 === subFormRowData.input64759 &&
          item.input59564 === subFormRowData.input59564 &&
          item.input58662 === subFormRowData.input58662 &&
          item.input37516 === subFormRowData.input37516)) {
          this.$message.warning('数据已添加');
          return;
        }
        console.log("subFormRowData:", subFormRowData);
        this.getWidgetRef('subform57714')?.insertSubFormRow(0, false, null, [subFormRowData]);
      }
      const query = {
        changeNo: this.changNo,
        partNumber: "",
        affectBOM: [
          {
            changeno: "",
            isrestructure: "",
            error: "",
            bomType: "",
            code: "",
            CustomerCode: "",
            devCode: "",
            productType: "",
            v2Model: "",
            MadeVietnam: "",
            MaterialCode: "",
            count: "",
            devCode: "",
            error: "",
            firstParent: "",
            materialDescription: "",
            objectid: "",
            objecttype: "",
            objectversion: "",
            productType: "",
            status: "",
          }
        ]
      }
      console.log("单号", this.changNo)
      // query.affectBOM = this.changeObject1.filter(item => item !== null && item !== undefined);
      const allowedKeys = [
        "changeno",
        "isrestructure",
        "error",
        "bomType",
        "code",
        "CustomerCode",
        "devCode",
        "productType",
        "v2Model",
        "MadeVietnam",
        "MaterialCode",
        "count",
        "firstParent",
        "materialDescription",
        "objectid",
        "objecttype",
        "objectversion",
        "status",
      ];
      query.affectBOM = this.changeObject1
        .filter(item => item !== null && item !== undefined)
        .map(item => {
          let obj = {};
          allowedKeys.forEach(key => {
            obj[key] = item[key] ?? ""; // 没有就填空字符串
          });
          return obj;
        });
      if (this.formData.selectType !== '增加') {
        console.log("123", this.Changeinformationinputdata.input2);
        query.partNumber = this.Changeinformationinputdata.input2;
        query.type = this.formData.selectObjectType;
      } else {
        console.log("312", this.Changeinformationinputdata.input5);
        query.partNumber = this.Changeinformationinputdata.input5;
        query.type = this.formData.selectObjectType;
      }
      console.log(JSON.stringify(query));
      try {
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
        const res = await api.post('/change/saveChangeImpactBOM', query);
        console.log(res.data);
        this.dialog.affectedOrderInformation4 = false;
      } catch { }
      finally {
        this.closeLoading();
      }
    },

    //关联变更替换分析关闭
    onCancel() {
      console.log('关闭按钮点击');
      this.dialog.affectedOrderInformation = false; // 关闭弹窗
      this.dialog.affectedOrderInformation4 = false; // 关闭弹窗
    },
    //受影响BOM详情确定按钮
    Submit3() {
      this.changeObject1 = this.Affectedbomdetailsselectdata;
      console.log("受影响BOM详情选中数据：", this.changeObject1);
      this.showAffectedBOM = false;
    },
    //影响分析确认按钮
    async submit() {
      this.queryOrderNubmer();
      var updateData = [];
      const selectedRows = this.ChangeImpactAnalysis.changeObject;
      var DrawingDocument = this.ChangeImpactAnalysis.DrawingDocument;
      console.log("DrawingDocument", DrawingDocument);
      console.log("selectedRows", selectedRows);
      if (selectedRows.length === 0) {
        this.$message.warning('请选择变更对象');
        return;
      }
      /* 添加至设计变更单中*/
      if (this.formType === '设计变更表单') {
        selectedRows.forEach(row => {
          const randomId = 'id' + Math.floor(Math.random() * 1000000);
          var exclusivesupplier = [];
          if (DrawingDocument.length !== 0) {
            DrawingDocument.forEach(row1 => {
              if (row1.documentNumber === row.code) {
                exclusivesupplier.push(row1.exclusivesupplier);
              }
            })
          }
          const subFormRowData = {
            _rowId_: randomId,
            input67563: row.code || '',
            input42296: row.name || '',
            input83973: row.VERSION || '',
            input55837: exclusivesupplier.join(',') || '',
            input73854: this.partNumber || '',
            input46642: row.ManufacturingAttributes || '',
            input44037: row.CustomerName || '',
            input27414: row.supplier || '',
            input63780: row.description || '',
          };
          if (!subFormRowData.input67563) {
            this.$message.warning('请选择变更对象');
            return;
          }
          //huangxumin
          if (this.getWidgetRef('subform47946').getSubFormValues().some(item =>
            item.input67563 === subFormRowData.input67563)) {
            this.$message.warning('数据已添加');
            return;
          }
          this.getWidgetRef('subform47946').insertSubFormRow(0, false, null, [subFormRowData]);
        });
        this.ChangeImpactAnalysis.changeNo = this.changNo;
        this.ChangeImpactAnalysis.partNumber = this.PatternCode;
        /* 添加至设计变更单中*/
        /* 添加至ECR表单中 */
      } else if (this.formType === '客户ECR表单') {

        selectedRows.forEach(row => {
          const randomId = 'id' + Math.floor(Math.random() * 1000000);
          var arrays1 = row.devCode.split(',');
          const uniqueArray = [...new Set(arrays1)];
          const result = uniqueArray.join(',');
          var arrays2 = row.CustomerName.split(',');
          const uniqueArray1 = [...new Set(arrays2)];
          const result2 = uniqueArray1.join(',');
          const subFormRowData = {
            _rowId_: randomId,
            input91754: row.code || '', //改前图样代号 
            input70543: row.name || '', //改前零部件名称
            input46642: row.ManufacturingAttributes || '',
            input44037: row.CustomerName || '',//相关大客户
            input69378: result2 || '',//相关大客户 add huangxumin
            input27414: row.supplier || '',//生成地
            input38707: result || '',//机型
            input40619: this.PatternCode || '',//搜索时的图样代号
            input63780: row.description || '',
          };
          var existData = this.getWidgetRef('subform47946')?.getSubFormValues();
          existData.forEach((row1, index) => {
            if (row1.input91754 === subFormRowData.input91754) {
              subFormRowData.radio70670 = row1.radio70670 || '',
                subFormRowData.input20159 = row1.input20159 || ''
              this.getWidgetRef('subform47946').deleteSubFormRow(index);
            }
          })
          //huangxumin
          // if (this.getWidgetRef('subform47946')?.getSubFormValues().some(item =>
          //   item.input91754 === subFormRowData.input91754 &&
          //   item.input40619 === subFormRowData.input40619)) {
          //   this.$message.warning('数据已添加');
          //   return;
          // }
          this.getWidgetRef('subform47946').insertSubFormRow(0, false, null, [subFormRowData]);
        });
        this.ChangeImpactAnalysis.changeNo = this.changNo;
        this.ChangeImpactAnalysis.partNumber = this.MaterialCode ? this.MaterialCode : this.PatternCode;
      } else if (this.formType === '订单更改通知书') {
        this.ChangeImpactAnalysis.changeNo = this.changNo;
        this.ChangeImpactAnalysis.partNumber = this.MaterialCode;
      } else if (this.formType === 5) {
        selectedRows.forEach(row => {
          const randomId = 'id' + Math.floor(Math.random() * 1000000);
          const subFormRowData = {
            _rowId_: randomId,
            radio73127: row.code || '', //改前图样代号 
            input80631: row.name || '', //改前零部件名称
          };
          var existData = this.getWidgetRef('subform47946')?.getSubFormValues();
          existData.forEach((row1, index) => {
            if (row1.radio73127 === subFormRowData.radio73127) {
              subFormRowData.radio73127 = row1.radio73127 || '',
                subFormRowData.input80631 = row1.input80631 || ''
              this.getWidgetRef('subform47946').deleteSubFormRow(index);
            }
          })
          this.getWidgetRef('subform47946').insertSubFormRow(0, false, null, [subFormRowData]);
        });
        this.ChangeImpactAnalysis.changeNo = this.changNo;
        this.ChangeImpactAnalysis.partNumber = this.PatternCode;

      }
      /* 添加至ECR表单中 */
      /* 订单更改通知单 */
      console.log("this.changNo", this.changNo);
      console.log("this.PatternCode", this.PatternCode);
      /* 订单更改通知单 */

      this.partNumber = this.PatternCode;

      if (this.ChangeImpactAnalysis.changeObject && this.ChangeImpactAnalysis.changeObject.length !== 0) {
        this.ChangeImpactAnalysis.changeObject.forEach(row => {
          row.changeNo = this.changNo;
          row.partnumber = this.PatternCode;
        });
      }

      if (this.ChangeImpactAnalysis.FinishedBOM && this.ChangeImpactAnalysis.FinishedBOM.length !== 0) {
        this.ChangeImpactAnalysis.FinishedBOM.forEach(row => {
          row.changeNo = this.changNo;
          row.partnumber = this.PatternCode;
        });
      }

      if (this.ChangeImpactAnalysis.DrawingDocument && this.ChangeImpactAnalysis.DrawingDocument.length !== 0) {
        this.ChangeImpactAnalysis.DrawingDocument.forEach(row => {
          row.changeNo = this.changNo;
          row.partnumber = this.PatternCode;
        });
      }

      if (this.ChangeImpactAnalysis.EBOM && this.ChangeImpactAnalysis.EBOM.length !== 0) {
        this.ChangeImpactAnalysis.EBOM.forEach(row => {
          row.changeNo = this.changNo;
          row.partnumber = this.PatternCode;
        });
      }

      if (this.ChangeImpactAnalysis.appointt && this.ChangeImpactAnalysis.appointt.length !== 0) {
        this.ChangeImpactAnalysis.appointt.forEach(row => {
          row.changeNo = this.changNo;
          row.partnumber = this.PatternCode;
        });
      }

      if (this.ChangeImpactAnalysis.authentication && this.ChangeImpactAnalysis.authentication.length !== 0) {
        this.ChangeImpactAnalysis.authentication.forEach(row => {
          row.changeNo = this.changNo;
          row.partnNmber = this.PatternCode;
        });
      }

      const jsonData = JSON.stringify(this.ChangeImpactAnalysis);
      console.log("json", jsonData);
      try {
        this.showLoading('加载中，请稍候...', 'rgba(0, 0, 0, 0.7)'); // 显示 loading
        const res = await api.post('/change/saveChangeImpactAnalysis', this.ChangeImpactAnalysis)
        console.log(res);
        this.$message.success("保存成功");
      } catch (error) {
        console.log(error);
      } finally {
        this.closeLoading();
      }
      this.Cancel();
    },
    //影响分析取消按钮
    Cancel() {
      this.dialog.affectedOrderInformation3 = false;  // 关闭当前弹窗
      this.dialog.affectedOrderInformation9 = false;
      this.dialog.affectedOrderInformation = false;

      // 清空弹窗内的数据
      this.changeObject = [];
      this.finishedBOM = [];
      this.appoint = [];
      this.ebom = [];
      this.DrawingDocument = [];
      this.inventory = [];
      this.module = [];
      this.authentication = [];
      this.ChangeImpactAnalysis = {
        changeObject: [],
        FinishedBOM: [],
        DrawingDocument: [],
        EBOM: [],
        appoint: [],
        authentication: []
      };

      // 清空选中项
      this.selectedChangeObjectRows = [];

      // 清空搜索框
      this.seachChangeObj2 = this.seachChangeObj;
      this.seachChangeObj = '';

      // 重置折叠面板
      this.activeNames = ['1', '2', '3', '4', '5', '6', '7', '8'];
    },
  }
};
</script>

<style scoped>
/* 加载功能 */
/* 强化选择器的优先级 */
.custom-loading .el-loading-spinner {
  border-top-color: #30C0B4 !important;
  /* 修改圆环的颜色 */
  border-left-color: #30C0B4 !important;
  /* 修改圆环的颜色 */
  border-width: 6px !important;
  /* 加粗加载环 */
  animation: rotate 1.2s linear infinite !important;
  /* 旋转动画效果 */
}

/* 加载文本的样式 */
.custom-loading .el-loading-text {
  font-size: 16px !important;
  /* 字体大小 */
  color: #fff !important;
  /* 文字颜色 */
  font-weight: bold !important;
  /* 字体加粗 */
  margin-top: 12px !important;
  /* 给文本和 spinner 之间添加间距 */
  font-family: 'Arial', sans-serif !important;
  /* 修改字体 */
  text-align: center !important;
}

/* 旋转动画 */
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* 加载功能 */
/* 指定管理模块样式 */
.dialog-footer {
  text-align: right;
}

/* 指定管理模块样式 */
/* 关联变更替换件分析 */
.floating-box-wrapper {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.floating-box {
  background: #fff;
  width: 85%;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.box-header {
  padding: 10px 16px;
  background: #f5f7fa;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.close-icon {
  cursor: pointer;
  font-size: 18px;
}

.double-form .form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.double-form .form-row .el-form-item {
  flex: 1;
}

.box-footer {
  padding: 10px 16px;
  text-align: right;
  border-top: 1px solid #ebeef5;
}

::v-deep .el-form-item__label {
  background-color: transparent !important;
}

.double-form ::v-deep .el-form-item__label {
  background-color: transparent !important;
}

/* 输入框与下拉框悬浮样式 */
.double-form ::v-deep .el-input__inner,
.double-form ::v-deep .el-select .el-input__inner {
  transition: all 0.2s ease;
}

/* 悬浮时边框 & 阴影 */
.double-form ::v-deep .el-input__inner:hover,
.double-form ::v-deep .el-select:hover .el-input__inner {
  border-color: #409EFF;
  /* Element 默认主题蓝 */
  box-shadow: 0 0 4px rgba(64, 158, 255, 0.4);
}

.form-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

.table-actions .el-button {
  background-color: rgb(48, 192, 180);
  border-color: rgb(48, 192, 180);
  color: #fff;
  margin-right: 10px;
  transition: all 0.2s ease;
}

.table-actions .el-button:hover {
  background-color: rgb(42, 170, 160);
  border-color: rgb(42, 170, 160);
}

.grid-input .el-input__inner {
  border: 1px solid #dcdfe6;
  /* 单个输入框边框，形成格子感 */
  border-radius: 4px;
  padding: 6px 10px;
}

.affected-bom-dialog .el-dialog {
  max-width: 95%;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

.affected-bom-dialog .el-dialog__body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.affected-bom-dialog .el-table {
  flex: 1;
}

.affected-bom-dialog .el-table__body-wrapper {
  max-height: calc(100% - 40px);
  overflow-y: auto;
}

.affected-bom-dialog .el-col {
  margin-bottom: 10px;
}

.affected-bom-dialog .el-form-item {
  margin-bottom: 0;
}

.affected-bom-dialog .el-button {
  margin: 0 5px;
}

.affected-bom-dialog .dialog-footer {
  display: flex;
  justify-content: center;
  width: 100%;
}

.floating-dialog .el-dialog {
  margin-top: 5vh !important;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

.floating-dialog .el-dialog__header {
  padding: 10px 16px;
  background: #f5f7fa;
  border-bottom: 1px solid #ebeef5;
}

.floating-dialog .el-dialog__title {
  font-weight: bold;
  font-size: 16px;
}

.floating-dialog .el-dialog__headerbtn {
  top: 13px;
  font-size: 18px;
}

.floating-dialog .el-dialog__body {
  flex: 1;
  padding: 0;
  overflow-y: auto;
}

.floating-dialog .el-dialog__footer {
  padding: 10px 16px;
  border-top: 1px solid #ebeef5;
}

/* 保持原有的所有样式 */
.double-form .form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.double-form .form-row .el-form-item {
  flex: 1;
}

.box-footer {
  padding: 10px 16px;
  text-align: right;
  border-top: 1px solid #ebeef5;
}

::v-deep .el-form-item__label {
  background-color: transparent !important;
}

.double-form ::v-deep .el-form-item__label {
  background-color: transparent !important;
}

.double-form ::v-deep .el-input__inner,
.double-form ::v-deep .el-select .el-input__inner {
  transition: all 0.2s ease;
}

.double-form ::v-deep .el-input__inner:hover,
.double-form ::v-deep .el-select:hover .el-input__inner {
  border-color: #409EFF;
  box-shadow: 0 0 4px rgba(64, 158, 255, 0.4);
}

.table-actions .el-button {
  background-color: rgb(48, 192, 180);
  border-color: rgb(48, 192, 180);
  color: #fff;
  margin-right: 10px;
  transition: all 0.2s ease;
}

.table-actions .el-button:hover {
  background-color: rgb(42, 170, 160);
  border-color: rgb(42, 170, 160);
}

.grid-input .el-input__inner {
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 6px 10px;
}

/* 零星采购申请表、试制样件采购计划、物料选点表单、选择对象 */
.custom-dialog {
  max-width: 1000px;
}

.search-container {
  margin-bottom: 20px;
}

.table-container {
  margin-bottom: 20px;
}

.no-data-cell {
  text-align: center;
}

.pagination-container {
  margin-top: 20px;
}

/* 零星采购申请表、试制样件采购计划、物料选点表单、选择对象 */

/* 去掉卡片边框/背景，更像悬浮面板 */
.import-dialog {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
  border-radius: 6px;
}

.import-dialog .el-dialog__header {
  padding: 12px 16px;
  cursor: move;
  /* 拖动提示 */
}

.import-dialog .el-dialog__body {
  padding: 16px;
}
</style>